Query not working when reasoning is on

Hi,

I have the following query:

SELECT ?s ?cls ?o
WHERE {
    VALUES ?cls { cco:Person cco:CommercialOrganization }
    ?s a ?cls .
    ?s skos:prefLabel|skos:altLabel|foaf:givenName|foaf:familyName|cco:is_tokenized_by ?o .
    #(?o ?score) <tag:stardog:api:property:textMatch> "PE~" .
}

basically I want to retrieve all the known labels for individuals in any class of :Person or :Company. This query works OK if I have the reasoning on but the moment I remove the comment in the last line in order to use fuzzy text search it returns an empty list.

The funny thing is that if I remove reasoning (and given that the data was asserted in a :Person or :Company class) the query works as expected.

What am I doing wrong here?

Can you share a minimal dataset that demonstrates the problem you're having? Something with a single Person or CommercialOrganization.

Can you elaborate on

cco, is that the common core ontology?

Sure and yes, cco stands for Common Core Ontology. The insert query is:

prefix ex: <http://example.org/stardog-test> 
prefix cco: <http://www.ontologyrepository.com/CommonCoreOntologies/>
prefix obo: <http://purl.obolibrary.org/obo/>
prefix foaf: <http://xmlns.com/foaf/0.1/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix skos: <http://www.w3.org/2004/02/skos/core#>

INSERT DATA {
    GRAPH <http://example.org/stardog-test> {
        :PhiladelphiaEnergySolutions rdf:type cco:CommercialOrganization ;
                             skos:altLabel "PES" ;
                             skos:prefLabel "Philadelphia Energy Solutions" .
        :PESJudgeGross rdf:type cco:Person ;
               foaf:familyName "Gross" ;
               foaf:givenName "Kevin" .
    }
 }

and with this named graph, the query still doesn't work

prefix cco: <http://www.ontologyrepository.com/CommonCoreOntologies/>
prefix obo: <http://purl.obolibrary.org/obo/>
prefix skos: <http://www.w3.org/2004/02/skos/core#>
prefix foaf: <http://xmlns.com/foaf/0.1/>

SELECT * WHERE {
    GRAPH <http://example.org/stardog-test> {
       VALUES ?cls { cco:Person cco:CommercialOrganization}
       ?s a ?cls .
       ?s skos:prefLabel|skos:altLabel|foaf:givenName|foaf:familyName|cco:is_tokenized_by ?o .
       (?o ?score) <tag:stardog:api:property:textMatch> "PE~" .
    }
 }

Maybe it is useful for you, but when preparing this example in a test db, I was able to run this query successfully with and without reasoning. It was the moment I inserted also the ontologies from Common Core Ontologies, SKOS, FOAF when the query stopped working.

Let me know if you need more info about the dataset or the DB.

Toni

What version of Stardog are you using and what reasoning profile are you using? ie SL, RL, QL, etc

Are there any warnings or errors in the stardog.log file?

What file or files did you load for the Common Core ontology?

You may already be aware of it but just to highlight, Stardog does not process owl:imports statements.

I've tested 6.2.2 and 7.0.1 with default reasoning (SL) and it doesn't work neither.

When running 7.0.1 in my docker I'm seeing logs that end in

WARN 2019-09-25 13:10:50,460 [stardog-user-2] com.clarkparsia.blackout.Saturator:saturate(104): Saturation was interrupted. Query results might be incomplete.

Previously there we a lot of logs about inconsistencies

WARN 2019-09-25 13:10:46,126 [stardog-user-2] com.clarkparsia.blackout.ProfileFilterBase:apply(39): Not a valid SL axiom: SubClassOf(countries:ISO3166DefinedCountry,cardinality(countries:countryCodeISO3166Alpha3,1,rdfs:Literal))
WARN 2019-09-25 13:10:46,135 [stardog-user-2] com.clarkparsia.blackout.ProfileFilterBase:apply(39): Not a valid SL axiom: EquivalentClasses(commonCoreOntologies:Agent, and(or(commonCoreOntologies:Animal, commonCoreOntologies:Organization), some(commonCoreOntologies:agent_in,obo:BFO_0000015)))
WARN 2019-09-25 13:10:46,137 [stardog-user-2] com.clarkparsia.blackout.ProfileFilterBase:apply(39): Not a valid SL axiom: EquivalentClasses(commonCoreOntologies:Agent, and(or(commonCoreOntologies:Animal, commonCoreOntologies:Organization), some(commonCoreOntologies:agent_in,obo:BFO_0000015)))
WARN 2019-09-25 13:10:46,137 [stardog-user-2] com.clarkparsia.blackout.ProfileFilterBase:apply(39): Not a valid SL axiom: EquivalentClasses(commonCoreOntologies:Agent, and(or(commonCoreOntologies:Animal, commonCoreOntologies:Organization), some(commonCoreOntologies:agent_in,obo:BFO_0000015)))
WARN 2019-09-25 13:10:46,138 [stardog-user-2] com.clarkparsia.blackout.ProfileFilterBase:apply(39): Not a valid SL axiom: EquivalentClasses(commonCoreOntologies:Agent, and(or(commonCoreOntologies:Animal, commonCoreOntologies:Organization), some(commonCoreOntologies:agent_in,obo:BFO_0000015)))
WARN 2019-09-25 13:10:46,139 [stardog-user-2] com.clarkparsia.blackout.ProfileFilterBase:apply(39): Not a valid SL axiom: EquivalentClasses(commonCoreOntologies:Agent, and(or(commonCoreOntologies:Animal, commonCoreOntologies:Organization), some(commonCoreOntologies:agent_in,obo:BFO_0000015)))
WARN 2019-09-25 13:10:46,140 [stardog-user-2] com.clarkparsia.blackout.ProfileFilterBase:apply(39): Not a valid SL axiom: EquivalentClasses(commonCoreOntologies:Agent, and(or(commonCoreOntologies:Animal, commonCoreOntologies:Organization), some(commonCoreOntologies:agent_in,obo:BFO_0000015)))
WARN 2019-09-25 13:10:46,140 [stardog-user-2] com.clarkparsia.blackout.ProfileFilterBase:apply(39): Not a valid SL axiom: EquivalentClasses(commonCoreOntologies:Agent, and(or(commonCoreOntologies:Animal, commonCoreOntologies:Organization), some(commonCoreOntologies:agent_in,obo:BFO_0000015)))

The files ontologies I'm loading are attached and I'm loading them using command

stardog data add $CONN_INFO $(ls imports/*)

I've uploaded in this ticket all the ontologies I'm using.ontologies.zip (260.2 KB)

To the best of my knowledge I've added all the files required to answer that query.

Please let me know if something is wrong or needs tweaking.

Toni

I can reproduce the problem you're seeing. I'm not sure if the exact reason for it but I suspect it's related to the following message in the logs

WARN 2019-09-26 12:38:29,154 [stardog-user-4] com.clarkparsia.blackout.Saturator:saturate(104): Saturation was interrupted. Query results might be incomplete.

It looks like they might be incomplete and indeed it is. There's also the problem that there are a ton of axioms that are outside of the SL profile. I don't know what the expressivity of the ontology is but it's based on BFO so I suspect it may be OWL-Full or at least OWL-DL

I ran a profiler tool on the ontology and it looks like it's got some problems.

OWL2_DL: 194 violations
OWL2_QL: 450 violations
OWL2_EL: 673 violations
OWL2_RL: 393 violations
OWL2_FULL: 194 violations

Some of them were related to punning so maybe if you enabled punning and set the reasoning profile to DL you might be ok but I got an exception when running your query with DL enabled.

How do you test the profiler on the ontologies/db?

By inspecting the logs, I think that for now I can live with fewer ontologies than the provided in the tar.gz (like the Countries.owl and Artifacts.ttl). I'd like to know if by removing things that aren't useful to me right now I could overcome the problem.

But also more generally, if we'd like to use Common Core Ontologies as our Mid level ontology, what's the configuration of Stardog that could afford that (reasoners, memory configuration, others...)?

I used this tool https://github.com/stain/profilechecker It's a little old but still works. I'm surprised it's such an obscure tool. If there's a better or tool or method I'd love to know about it. I doubt there are many people that can remember exactly what axioms are allowed in all the profiles.....except maybe @evren :wink:

I would suggest taking a close look at the reasoning section in the documentation https://www.stardog.com/docs/#_reasoning_types Especially the section on DL

You many also want to look at the reasoning.punning.enabled and reasoning.approximate options.

My personal opinion is you should carefully evaluate your need to use common core ontologies. I don't think they were designed with much concern with actually using them. They are the base that you're going to build everything onto and they are already pushing you to DL at a minimum. You can't go back from there.

You should also take a look at the section Performance Hints, specifically the suggestion to, "Avoid unnecessarily deep class/property hierarchies." and you may be able to make use of the new dynamic schema functionality. https://www.stardog.com/docs/#_reasoning_with_multiple_schemas

It's nice to build beautiful buildings but an architect has to be an artist and and engineer.

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