我被迫将外部推理器Pellet包含在我的Fuseki服务器中。到目前为止,一切都很好,尽管事实上,我无法删除包含字符串(如String或Integer)的三元组。 我的设置:Fuseki 0.2.6配置了Pellet 2.3.1作为推理器 最小的示例配置:
@prefix : <#> .
@prefix fuseki: <http://jena.apache.org/fuseki#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix tdb: <http://jena.hpl.hp.com/2008/tdb#> .
@prefix ja: <http://jena.hpl.hp.com/2005/11/Assembler#> .
[] rdf:type fuseki:Server ;
fuseki:services (
<#mem>
) .
## ---------------------------------------------------------------
## Updatable in-memory dataset.
<#mem> rdf:type fuseki:Service ;
# URI of the dataset -- http://host:port/mem
fuseki:name "mem" ;
fuseki:serviceQuery "sparql" ;
fuseki:serviceQuery "query" ;
fuseki:serviceUpdate "update" ;
fuseki:serviceUpload "upload" ;
fuseki:serviceReadWriteGraphStore "data" ;
fuseki:serviceReadGraphStore "get" ;
fuseki:dataset <#emptyDataset> ;
.
## In-memory, initially empty.
<#emptyDataset> rdf:type ja:RDFDataset ;
ja:defaultGraph <#model_inf1> ;
.
<#model_inf1> rdfs:label "Inf-model" ;
ja:reasoner
[ ja:reasonerClass
"org.mindswap.pellet.jena.PelletReasonerFactory";]
.
内存中加载的最小owl文件:
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY test "http://www.semanticweb.org/ontologies/2014/9/test.owl#" >
]>
<rdf:RDF xmlns="http://www.semanticweb.org/ontologies/2014/9/test.owl#"
xml:base="http://www.semanticweb.org/ontologies/2014/9/test.owl"
xmlns:test="http://www.semanticweb.org/ontologies/2014/9/test.owl#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
<owl:Ontology rdf:about="http://www.semanticweb.org/ontologies/2014/9/test.owl"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Data properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/2014/9/test.owl#hasAge -->
<owl:DatatypeProperty rdf:about="&test;hasAge">
<rdfs:domain rdf:resource="&test;human"/>
<rdfs:range rdf:resource="&xsd;integer"/>
</owl:DatatypeProperty>
<!-- http://www.semanticweb.org/ontologies/2014/9/test.owl#hasName -->
<owl:DatatypeProperty rdf:about="&test;hasName">
<rdfs:domain rdf:resource="&test;human"/>
<rdfs:range rdf:resource="&xsd;string"/>
</owl:DatatypeProperty>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/2014/9/test.owl#human -->
<owl:Class rdf:about="&test;human"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/ontologies/2014/9/test.owl#Alfred -->
<owl:NamedIndividual rdf:about="&test;Alfred">
<rdf:type rdf:resource="&test;human"/>
</owl:NamedIndividual>
</rdf:RDF>
我正在运行服务器&#34; - update&#34;在localhost上标记,加载以上&#34; test.owl&#34;进入默认图表,然后插入两个文字:
insert data {test:Alfred test:hasName "Alfred"^^xsd:string;
test:hasAge "43"^^xsd:integer .}
查询与&#34; Alfred&#34;相关联的所有三元组。显示,插入成功:
PREFIX test: <http://www.semanticweb.org/ontologies/2014/9/test.owl#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Select *
Where{test:Alfred ?p ?o}
--------------------------------------------------------------------------------------------
| p | o |
============================================================================================
| rdfs:type | test:human |
| rdfs:type | <http://www.w3.org/2002/07/owl#Thing> |
| <http://www.w3.org/2002/07/owl#sameAs> | test:Alfred |
| test:hasAge | 43 |
| test:hasName | "Alfred"^^xsd:string |
| rdfs:type | <http://www.w3.org/2002/07/owl#NamedIndividual> |
-------------------------------------------------------------------------------------------
然后我尝试删除阿尔弗雷德的年龄和名字:
delete data {test:Alfred test:hasAge "43"^^xsd:integer}
delete data {test:Alfred test:hasName "Alfred"^^xsd:string}
但无论我尝试哪种删除模式,都无法删除文字。我检查了SPARQL Update语法,没有错误。可以插入和删除不包含任何文字的三元组而不会出现问题。我认为这个行为可以通过pellet插件引发,因为所有删除操作都使用fuseki服务器使用其默认的jena推理器。升级到Fuseki 1.1.1不是一个选项,因为这似乎会导致与弹丸的兼容性/可见性问题显示错误:
Error 500: tried to access field com.hp.hpl.jena.reasoner.BaseInfGraph.isPrepared from class org.mindswap.pellet.jena.PelletInfGraph
Fuseki - version 1.1.1 (Build date: 2014-10-02T16:36:17+0100)
我也试过这个TDB数据库结果与我无法删除任何带文字的三元组相同的结果。任何人都可以重现这种行为吗?有人知道解决方案或解决方法吗?我错过了什么吗?我会很感激任何提示。感谢您的支持和努力 - 迈克尔