Reasoning explanation over HTTP not working

(Mikel Egaña Aranguren) #1

Hi:

I'm trying to obtain the explanation of an inference over HTTP but I cannot make it work.

I have added RDF and an ontology with a property chain to Stardog (6.1.1) and the inference works, since this query returns nothing with reasoning off, and a set of bindings with the reasoning on, as a result of the property chain:

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX voc:<https://company.org/def/CompanySchema#>

SELECT ?department ?expertise
WHERE {
  ?department rdf:type voc:Department .
  ?department voc:requiresExpertise ?expertise
}

I'm trying to retrieve the explanations with the following request:

curl -u admin:admin -X POST -H "Content-Type: text/turtle" --data "@explainPropertyChain.ttl" http://localhost:5820/SAFRAN-reasoning/reasoning/explain

The content of explainPropertyChain.ttl being one of the triples retrieved by the query with reasoning on:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX voc: <https://company.org/def/CompanySchema#>
PREFIX department: <https://company.org/id/department/>
PREFIX expertise: <https://company.org/id/expertise/>

department:41622	voc:requiresExpertise	expertise:Compensator .

However the response of the HTTP request is an empty set of proofs:

{
  "proofs": []
}

What am I missing?

Thank you,

[UPDATE]

Adding an axiom to make the ontology inconsistent:

PREFIX voc:<https://company.org/def/CompanySchema#>

INSERT DATA {
	voc:Manager owl:disjointWith voc:ProductManager .
}

And retrieving the explanation of inconsistency does work:

curl -u admin:admin -X GET http://localhost:5820/SAFRAN/reasoning/explain/inconsistency
{
  "proofs": [
    {
      "status": "VIOLATED",
      "expression": "@prefix : \u003chttp://api.stardog.com/\u003e .\n@prefix rdf: \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#\u003e .\n@prefix rdfs: \u003chttp://www.w3.org/2000/01/rdf-schema#\u003e .\n@prefix xsd: \u003chttp://www.w3.org/2001/XMLSchema#\u003e .\n@prefix owl: \u003chttp://www.w3.org/2002/07/owl#\u003e .\n@prefix stardog: \u003ctag:stardog:api:\u003e .\n\n\u003chttps://company.org/def/CompanySchema#Manager\u003e owl:disjointWith \u003chttps://company.org/def/CompanySchema#ProductManager\u003e .",
      "children": [
        {
          "status": "ASSERTED",
          "expression": "@prefix : \u003chttp://api.stardog.com/\u003e .\n@prefix rdf: \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#\u003e .\n@prefix rdfs: \u003chttp://www.w3.org/2000/01/rdf-schema#\u003e .\n@prefix xsd: \u003chttp://www.w3.org/2001/XMLSchema#\u003e .\n@prefix owl: \u003chttp://www.w3.org/2002/07/owl#\u003e .\n@prefix stardog: \u003ctag:stardog:api:\u003e .\n\n\u003chttps://company.org/def/CompanySchema#Manager\u003e owl:disjointWith \u003chttps://company.org/def/CompanySchema#ProductManager\u003e .",
          "children": [],
          "namedGraphs": []
        },
        {
          "status": "INFERRED",
          "expression": "@prefix : \u003chttp://api.stardog.com/\u003e .\n@prefix rdf: \u003chttp://www.w3.org/1999/02/22-rdf-syntax-ns#\u003e .\n@prefix rdfs: \u003chttp://www.w3.org/2000/01/rdf-schema#\u003e .\n@prefix xsd: \u003chttp://www.w3.org/2001/XMLSchema#\u003e .\n@prefix owl: \u003chttp://www.w3.org/2002/07/owl#\u003e .\n@prefix stardog: \u003ctag:stardog:api:\u003e .\n\n\u003chttps://company.org/id/lambert-faust\u003e a \u003chttps://company.org/def/CompanySchema#ProductManager\u003e .",
          "children": [

...

So I'm doing something wrong on the request but I cannot pin it

[UPDATE 2]

Explanation also works for new triples inferred trough SWRL rule. So, so far:

  • Explanation works: consistency, SWRL.
  • Explanation does not work (states there is nothing to explain): property chain, class expression.
(zachary.whitley) #2

Welcome to the Stardog community.

Can you run it and do you get a result from the command line?

You might want to give it a try with the old turtle prefix style (@prefix blah http://blah.blah .) I have no reason to believe that's the problem but it would only take a second and it's something you can try.

(Mikel Egaña Aranguren) #3

Hi, thanks.

My original request does work in the command line, but I only receive a JSON array of empty proofs.

Trying the old turtle syntax gives me this, so I think that won't work:

{"message":"Unknown directive \"@PREFIX\" [L1]"}

Cheers

(zachary.whitley) #4

That's somewhat interesting. If you're up for trying something else, what if you get rid of the prefixes and just use full urls? Basically n-triples. <s> <p> <o> .

Just to clairify, you siad the original request does work in the comand line but you only receive a JSON array of empty proofs. That implies you were expecting to only receive an empty array. Did you perhaps mean doesn't work? Or did you mean that it does work from the command line and returns results but doesn't work with the rest call?

(Mikel Egaña Aranguren) #5

That's somewhat interesting. If you're up for trying something else, what if you get rid of the prefixes and just use full urls? Basically n-triples. <s> <p> <o> .

Doesn't work either

Just to clairify, you siad the original request does work in the comand line but you only receive a JSON array of empty proofs.

I missunderstood your comment, sorry. I haven't try the command line (I will in a second), I have just used the HTTP call with curl. I'm expecting a response with a JSON array named "proofs" that contains explanations, now I receive such array but it is empty

(Mikel Egaña Aranguren) #6

I have tried the command line:

stardog reasoning explain SAFRAN x.ttl

Indeed the answer is that there is no proof to show:

Input axiom is not inferred; nothing to explain.

However, the input axiom is shown as a result when executing the query with inference on, and it doesn't exist in the original data. So it must be surely inferred?

(zachary.whitley) #7

I forgot to ask. Are there any errors or warnings in the logs?

(Mikel Egaña Aranguren) #8

I haven't found anything noteworthy in the logs (I'm not an expert though). Also, I find it weird that explanation is working for consistency checking and not for that concrete axiom

(Evren Sirin) #9

There is a limitation with explaining some transitive/recursive inferences. Could this be the case here? Can you share an example that reproduces the issue so we can investigate?

Best,

Evren

(Mikel Egaña Aranguren) #10

The axiom I'm using for inference is a property chain:

 
:requiresExpertise rdf:type owl:ObjectProperty ;
                   rdfs:range :Expertise ;
                   owl:propertyChainAxiom ( :offersProduct
                                            :requiresExpertise
                                          ) .

I have exported the data from Stardog and uploaded it, so you can reproduce with the following query (Reasoning on/off):

PREFIX rdf:<http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX voc:<https://company.org/def/CompanySchema#>

SELECT ?department ?expertise
WHERE {
  ?department rdf:type voc:Department .
  ?department voc:requiresExpertise ?expertise
}

thanks!export.ttl (419.2 KB)