当我使用此预定义查询在 Fuseki UI 中查询数据集时:
SELECT ?subject ?predicate ?object
WHERE {
?subject ?predicate ?object
}
LIMIT 25
它响应时没有可用数据。
但是,如果我打开编辑选项卡并单击默认图表,它会显示我的所有数据。
我认为这是一个配置问题,但在文档中找不到任何提示。
shiro 中端点设置为 anon
/**/query = anon
Endpoints 以最基本的方式配置:
fuseki:endpoint [
fuseki:operation fuseki:query ;
fuseki:name "sparql" ;
## Set default-union-graph for this endpoint.
ja:context [ ja:cxtName "tdb:unionDefaultGraph" ; ja:cxtValue true ] ;
] ;
fuseki:endpoint [
fuseki:operation fuseki:query ;
fuseki:name "query"
] ;
当我通过 http 查询数据时,服务器响应包含我所有数据的 ttl 文件:
http://localhost:8081/dataset/data?default
Fuseki 服务器和 Web 应用程序使用以下组合配置在 Docker 容器内运行:
version: '3'
services:
web:
image: tomcat:9.0
ports:
- "8081:8080"
volumes:
- ./logs/fuseki:/etc/fuseki/logs
- ./logs/tomcat:/usr/local/tomcat/logs
- ./triplestore/ROOT.war:/usr/local/tomcat/webapps/ROOT.war
- ./shiro.ini:/etc/fuseki/shiro.ini
- ./config.ttl:/etc/fuseki/config.ttl
任何关于查询不起作用的建议都值得赞赏。
我尝试使用 WebUI 和通过curl 进行查询,两者的结果相同。只能通过 http 下载。
编辑:我将数据放入商店的方式
我使用 python 脚本将数据加载到商店中。
def write_to_fuseki():
print('write to fuseki')
headers = {'Content-Type': 'text/turtle;charset=utf-8'}
r = requests.put('http://localhost:8081/dataset/data?default',headers=headers, data=open('ontology/test.ttl', 'rb'), auth=('user', 'pw'))
我找到了这个问题的解决方案:
使用 Java 客户端将 .ttl 文件上传到 Fuseki - 我的三元组在 Fuseki 中在哪里?
看来联合默认图形设置没有达到我的预期。我更改了配置,并删除了所有 unionDefaultGraph 设置并知道我的数据出现在搜索中。
:service rdf:type fuseki:Service ;
fuseki:name "dataset" ;
fuseki:endpoint [
fuseki:operation fuseki:query ;
fuseki:name "sparql" ;
] ;
fuseki:endpoint [
fuseki:operation fuseki:query ;
fuseki:name "query"
] ;
fuseki:endpoint [
fuseki:operation fuseki:update ;
fuseki:name "update"
] ;
fuseki:endpoint [
fuseki:operation fuseki:gsp-r ;
fuseki:name "get"
] ;
fuseki:endpoint [
fuseki:operation fuseki:gsp-rw ;
fuseki:name "data"
] ;
fuseki:endpoint [
fuseki:operation fuseki:patch ;
fuseki:name "patch"
] ;
fuseki:dataset :dataset_tdb2 ;
.
:dataset_tdb2 rdf:类型 tdb2:DatasetTDB2 ; tdb2:位置“数据库/db” .