# Reasoning explanation over HTTP not working

**URL:** <https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646>\
**Category:** Support\
**Created:** [May 8, 2019, 3:53pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646 "2019-05-08T15:53:18Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![mikel.eganaaranguren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/mikel.eganaaranguren/32/414_2.png) [@mikel.eganaaranguren](https://community.stardog.com/u/mikel.eganaaranguren)\
**Post date:** [May 8, 2019, 3:53pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/1 "2019-05-08T15:53:18Z")

</div>

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:

```auto
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:

```auto
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:

```auto
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:

```auto
{
  "proofs": []
}

```

What am I missing?

Thank you,

[UPDATE]

Adding an axiom to make the ontology inconsistent:

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

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

```

And retrieving the explanation of inconsistency does work:

```bash
curl -u admin:admin -X GET http://localhost:5820/SAFRAN/reasoning/explain/inconsistency

```

```json
{
  "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.

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [May 8, 2019, 4:08pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/2 "2019-05-08T16:08:33Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![mikel.eganaaranguren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/mikel.eganaaranguren/32/414_2.png) [@mikel.eganaaranguren](https://community.stardog.com/u/mikel.eganaaranguren)\
**Post date:** [May 8, 2019, 4:29pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/3 "2019-05-08T16:29:03Z")

</div>

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:

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

```

Cheers

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [May 8, 2019, 4:53pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/4 "2019-05-08T16:53:23Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mikel.eganaaranguren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/mikel.eganaaranguren/32/414_2.png) [@mikel.eganaaranguren](https://community.stardog.com/u/mikel.eganaaranguren)\
**Post date:** [May 8, 2019, 5:05pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/5 "2019-05-08T17:05:21Z")

</div>

> 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

---

<div class="post-metadata">

**Author:** ![mikel.eganaaranguren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/mikel.eganaaranguren/32/414_2.png) [@mikel.eganaaranguren](https://community.stardog.com/u/mikel.eganaaranguren)\
**Post date:** [May 8, 2019, 5:13pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/6 "2019-05-08T17:13:18Z")

</div>

I have tried the command line:

```auto
stardog reasoning explain SAFRAN x.ttl

```

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

```auto
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?

---

<div class="post-metadata">

**Author:** ![zachary.whitley](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/zachary.whitley/32/94_2.png) [@zachary.whitley](https://community.stardog.com/u/zachary.whitley)\
**Post date:** [May 8, 2019, 5:14pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/7 "2019-05-08T17:14:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mikel.eganaaranguren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/mikel.eganaaranguren/32/414_2.png) [@mikel.eganaaranguren](https://community.stardog.com/u/mikel.eganaaranguren)\
**Post date:** [May 8, 2019, 5:22pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/8 "2019-05-08T17:22:12Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![evren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/evren/32/1515_2.png) [@evren](https://community.stardog.com/u/evren)\
**Post date:** [May 8, 2019, 5:29pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/9 "2019-05-08T17:29:20Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![mikel.eganaaranguren](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/mikel.eganaaranguren/32/414_2.png) [@mikel.eganaaranguren](https://community.stardog.com/u/mikel.eganaaranguren)\
**Post date:** [May 8, 2019, 5:38pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/10 "2019-05-08T17:38:50Z")

</div>

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

```auto
 
: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):

```auto
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](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/1X/8b1dc5421b97df95ac279e647f68eb42f9fa8f40.ttl) (419.2 KB)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [May 22, 2019, 5:38pm UTC](https://community.stardog.com/t/reasoning-explanation-over-http-not-working/1646/11 "2019-05-22T17:38:50Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
