You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@rya.apache.org by "Jesse Hatfield (JIRA)" <ji...@apache.org> on 2017/07/20 15:57:00 UTC

[jira] [Comment Edited] (RYA-301) Implement owl:ReflexiveProperty inference

    [ https://issues.apache.org/jira/browse/RYA-301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16092297#comment-16092297 ] 

Jesse Hatfield edited comment on RYA-301 at 7/20/17 3:56 PM:
-------------------------------------------------------------

Given {code}:p rdf:type owl:ReflexiveProperty{code}
We can infer:
{quote}For all x, (x p x) .{quote}
That means queries of the form{code}SELECT ?o WHERE { :s :p ?o }{code} should be expanded to
{code}SELECT ?o WHERE {
    { :s :p ?o } UNION { {} VALUES ?o { :s } } .
}{code}
And likewise in reverse.

When both subject and object are variables, the implication of {code}SELECT ?s :p ?o WHERE { ?s :p ?o }{code} is to return a triple for every URI in the database. This might be a reasonable thing to query for in combination with other conditions, e.g. "get all pairs of relatives who both have some other unusual property", but may be challenging to implement efficiently.

At inference engine refresh, query for the reflexive properties just like is currently done for symmetric and transitive properties:
{code}reflexiveProperties <- Set<property>
for property in query(?property rdf:type owl:ReflexiveProperty):
    reflexiveProperties.add(property){code}
At query time, a visitor can handle the case where one of the subject or object is defined as follows:
{code}meet(StatementPattern originalSP):
    if originalSP like (:s :p ?o):  //defined subject, variable object
        if inferenceEngine.isReflexive(p):
            reflexiveSolution <- BindingSet({ Binding(:s as ?o) })
            reflexiveSolutionAssignment <- BindingSetAssignment({ reflexiveSolution })
            originalSP.replaceWith(InferUnion(originalSP, reflexiveSolutionAssignment))
    else if originalSP like (?s :p :o):  //defined object, variable subject
        if inferenceEngine.isReflexive(p):
            reflexiveSolution <- BindingSet({ Binding(:o as ?s) })
            reflexiveSolutionAssignment <- BindingSetAssignment({ reflexiveSolution })
            originalSP.replaceWith(InferUnion(originalSP, reflexiveSolutionAssignment)){code}


was (Author: jhatfiel):
Given {code}:p rdf:type owl:ReflexiveProperty{code}
We can infer:
{quote}For all x, (x p x) .{quote}
That means queries of the form{code}SELECT ?o WHERE { :s :p ?o }{code} should be expanded to
{code}SELECT ?o WHERE {
    { :s :p ?o } UNION { BIND(:s as ?o } .
}{code}
And likewise in reverse.

When both subject and object are variables, the implication of {code}SELECT ?s :p ?o WHERE { ?s :p ?o }{code} is to return a triple for every URI in the database. This might be a reasonable thing to query for in combination with other conditions, e.g. "get all pairs of relatives who both have some other unusual property", but may be challenging to implement efficiently.

At inference engine refresh, query for the reflexive properties just like is currently done for symmetric and transitive properties:
{code}reflexiveProperties <- Set<property>
for property in query(?property rdf:type owl:ReflexiveProperty):
    reflexiveProperties.add(property){code}
At query time, a visitor can handle the case where one of the subject or object is defined as follows:
{code}meet(StatementPattern originalSP):
    if originalSP like (:s :p ?o):  //defined subject, variable object
        if inferenceEngine.isReflexive(p):
            reflexiveSolution <- BindingSet({ Binding(:s as ?o) })
            reflexiveSolutionAssignment <- BindingSetAssignment({ reflexiveSolution })
            originalSP.replaceWith(InferUnion(originalSP, reflexiveSolutionAssignment))
    else if originalSP like (?s :p :o):  //defined object, variable subject
        if inferenceEngine.isReflexive(p):
            reflexiveSolution <- BindingSet({ Binding(:o as ?s) })
            reflexiveSolutionAssignment <- BindingSetAssignment({ reflexiveSolution })
            originalSP.replaceWith(InferUnion(originalSP, reflexiveSolutionAssignment)){code}

> Implement owl:ReflexiveProperty inference
> -----------------------------------------
>
>                 Key: RYA-301
>                 URL: https://issues.apache.org/jira/browse/RYA-301
>             Project: Rya
>          Issue Type: Sub-task
>          Components: sail
>            Reporter: Jesse Hatfield
>
> An *{{owl:ReflexiveProperty}}* is a property that connects every resource to itself.
> If the ontology states that {{:hasRelative}} is a reflexive property, i.e. that everyone is their own relative, then the inference engine should ensure that queries of either form {{:Alice :hasRelative ?x}} or {{?x :hasRelative :Alice}} return the binding {{:Alice}} for {{?x}} .



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)