I'm not sure about all the exact reasons for this so some of this is speculation but I was able to get it to work. I'll do my best to try to explain what I think is going on.
If you query for everything without reasoning.
SELECT * WHERE {
?s ?p ?o
}
You get the expected output
+------------+--------------------+----------------------+
| s | p | o |
+------------+--------------------+----------------------+
| :propA | rdf:type | owl:DatatypeProperty |
| :propA-1 | rdf:type | owl:DatatypeProperty |
| :propA-1 | rdfs:subPropertyOf | :propA |
| :propA-1-1 | rdf:type | owl:DatatypeProperty |
| :propA-1-1 | rdfs:subPropertyOf | :propA-1 |
| :propA-2 | rdf:type | owl:DatatypeProperty |
| :propA-2 | rdfs:subPropertyOf | :propA |
| :propA-2-1 | rdf:type | owl:DatatypeProperty |
| :propA-2-1 | rdfs:subPropertyOf | :propA-2 |
| :object1 | :propA-1-1 | "some first value" |
| :object1 | :propA-2-1 | "some second value" |
+------------+--------------------+----------------------+
The important thing to note is that you see your TBOX and your DatatypeProperties but if you enable reasoning you don't.
+----------+------------+---------------------+
| s | p | o |
+----------+------------+---------------------+
| :object1 | :propA | "some first value" |
| :object1 | :propA | "some second value" |
| :object1 | :propA-2 | "some second value" |
| :object1 | :propA-1 | "some first value" |
| :object1 | :propA-1-1 | "some first value" |
| :object1 | :propA-2-1 | "some second value" |
| :object1 | rdf:type | owl:Thing |
+----------+------------+---------------------+
I think they get somehow get pulled into the schema graph which is only accessible to the reasoner and isn't available to queries. If that's the case than the ABOX portion of your query doesn't see anything and you don't get any queries.
To solve this it seems like you want to execute one portion of your query with reasoning and another portion without.
The solution I came up with was to use a service clause. You'll need some setup to get it to work. First you'll need a services.sdpass file in your $STARDOG_HOME. Adding "::*:admin:admin" would work with a default install. Adjust the user name and password for your installation.
The second thing you'll need to do is change the property reasoning.virtual.graph.enabled to false.
Then you should be able to execute your query with reasoning enabled
SELECT ?s ?p ?o WHERE {
?s ex:propA ?o .
?s ?p ?o .
FILTER NOT EXISTS {
SERVICE <http://localhost:5820/test/query> {
?fictiveSubProp rdfs:subPropertyOf ?p .
FILTER (?p != ?fictiveSubProp)
}
}
}
which returns the expected results
+----------+------------+---------------------+
| s | p | o |
+----------+------------+---------------------+
| :object1 | :propA-1-1 | "some first value" |
| :object1 | :propA-2-1 | "some second value" |
+----------+------------+---------------------+
Some interesting things I came across while trying to figure this out were. If you enable reasoning over the service clause it fails with
"An unexpected exception was handled by the server
com.stardog.stark.query.QueryExecutionFailure: com.complexible.stardog.plan.eval.ExecutionException: Service clause contains a pattern not supported by reasoning: prefix : <http://api.stardog.com/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix stardog: <tag:stardog:api:>
Schema(?fictiveSubProp, rdf:type, owl:DatatypeProperty)
`─ {
`─ Singleton [#1]
}
NOTE: the ex: prefix isn't there because I made the ex: prefix just :
I also tried it the other way around with reasoning off for the query but enabling reasoning for the service query by making they service query
SERVICE <http:;//localhost:5820/test/query?reasoning=true>
But that failed with the following error
ERROR 2018-12-18 09:59:48,063 [stardog-user-58] com.complexible.stardog.protocols.http.server.StardogHttpServiceLoader:accept(235): An unexpected exception was handled by the server
com.stardog.stark.query.QueryExecutionFailure: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Content is not allowed in prolog. [L1:1]
If I were to guess the query is just being concatenated on the end it's blowing up because there's already a parameter on there. Something like http://localhost:5820/test/query?reasoning=true?query=.... but that's just a guess.
This was all done with Stardog 6.0.0 so you might want to upgrade if this doesn't work for you.