Skip to content

named individual flag not making any difference in expression-to-sparql conversion #133

Open
@alkidbaci

Description

@alkidbaci

For the example class expression:

ce = OWLObjectAllValuesFrom(property=OWLObjectProperty(IRI('http://www.benchmark.org/family#', 'hasParent')),filler=OWLObjectComplementOf(OWLClass(IRI('http://www.benchmark.org/family#', 'Father'))))

the method owl_expression_to_sparql(ce, named_individuals=False) will output the following query:

SELECT
 DISTINCT ?x WHERE { 
?x ?s_1 ?s_2 . 
FILTER NOT EXISTS { 
?x <http://www.benchmark.org/family#hasParent> ?s_3 . 
FILTER NOT EXISTS { 
?s_3 ?s_4 ?s_5 . 
FILTER NOT EXISTS { 
?s_3 a <http://www.benchmark.org/family#Father> . 
 }
 }
 }
 }

Whereas the method owl_expression_to_sparql(ce, named_individuals=True) will output the following query:

SELECT
 DISTINCT ?x WHERE { 
?x ?s_1 ?s_2 . 
FILTER NOT EXISTS { 
?x <http://www.benchmark.org/family#hasParent> ?s_3 . 
FILTER NOT EXISTS { 
?s_3 a <http://www.w3.org/2002/07/owl#NamedIndividual> . 
FILTER NOT EXISTS { 
?s_3 a <http://www.benchmark.org/family#Father> . 
 }
 }
 }
 }

Notice that the second query wont filter out the subjects that are not named individuals for the ?x variable but for ?s_3, hence a trivial statement.
Instead we should have a rule as follows:

SELECT
 DISTINCT ?x WHERE { 
?x ?s_1 ?s_2 . 
?x a <http://www.w3.org/2002/07/owl#NamedIndividual> . 
....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions