0

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

Mitch S
  • 1
  • 1
  • 1
    The error looks like you're using version of Pellet that expects and older version of Jena, or vice versa. Something is trying to access the `isPrepared` field, but it's not there. I don't expect that this essentially has much to do with literals, though you mention that it works for triples without literals, but rather something done with literals is triggering some part of the code that tries to refresh a model, or something. – Joshua Taylor Oct 17 '14 at 14:58
  • If you search for that specific error message (without the ERROR 500, which is the HTTP error, and I think is just because the underlying error is getting wrapped), there are [a bunch of results on Google](https://www.google.com/search?q=%22tried+to+access+field+com.hp.hpl.jena.reasoner.BaseInfGraph.isPrepared+from+class+org.mindswap.pellet.jena.PelletInfGraph%22) that might help. – Joshua Taylor Oct 17 '14 at 15:00
  • E.g., [this blog post](http://datababel.wordpress.com/2013/06/18/jena-2-10-1-and-pellet-2-3-4-illegalaccesserror/) mentions "It transpires that from Jena 2.10.1 onwards (as can be seen in this change on GIT) this isPrepared has had its visibility reduced from protected to private. The good news is that you can continue to use 2.10.0, where visibility is just fine." – Joshua Taylor Oct 17 '14 at 15:01
  • you might consider using stardog which has jena bindings if you prefer that API and includes the most recent version of pellet. – Michael Oct 17 '14 at 19:02
  • Thanks for your replies. I am not struggeling with the error 500. Fuseki 1.1.1 seems not to be compatible with pellet 2.3.1 causing that error. Therefore, I am using fuseki 0.2.6 which works nice despite the deleting of triples containing literals. So the error 500 does not really bother me so far as it works with the older fuseki version. Can somebody reproduce the error with fuseki 0.2.6 and pellet 2.3.1 with my configuration (see above) or has any advice to overcome this issue with my configuration described? Thank you so much for your help – Mitch S Oct 18 '14 at 14:55
  • I dug around in pellet configuration files and found the "USE_INCREMENTAL_DELETION = false" option in the source code distribution of pellet (core\src\main\resources\pellet.properties). Could that be a possible reason for my problem? Can anybody give me a hint how to recompile (create according jar-files) out of the edited pellet source files to be able to include them in my fuseki config just like the binary distribution of pellet? Thank you for your support. – Mitch S Nov 19 '14 at 11:33

0 Answers0