I am forced to include the external reasoner Pellet with my Fuseki server. So far everything works nice, despite the fact, that I am not able to delete triples containing a literal such as a String or an Integer.
My setup: Fuseki 0.2.6 configured with Pellet 2.3.1 as reasoner.
Minimal example config:
@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";]
.
Minimal owl file loaded in memory:
<?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>
I am running the server with "--update" flag on localhost, load above "test.owl" into default graph and then I insert two literals:
insert data {test:Alfred test:hasName "Alfred"^^xsd:string;
test:hasAge "43"^^xsd:integer .}
Querying all triples linked with "Alfred" shows, that inserting succeeded:
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> |
-------------------------------------------------------------------------------------------
Then I try to delete Alfred's age and name:
delete data {test:Alfred test:hasAge "43"^^xsd:integer}
delete data {test:Alfred test:hasName "Alfred"^^xsd:string}
But no matter which delete pattern I try, literals cannot be removed. I checked SPARQL Update syntax without errors. Triples not containing any literals can be inserted and deleted without problems. I think this behavior could be raised by the pellet plugin as all delete operations work with fuseki server using its default jena reasoner. Upgrading to Fuseki 1.1.1 is not an option, as this seems to arise compatibility/visibility problems with pellet showing the error:
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)
I also tried this with TDB database ending up with the same result that I could not delete any triples with literals. Can anybody reproduce this behavior? Does anybody know a solution or a workaround? Am I missing something? I would appreciate any hints. Thank you for your support and effort - Michael