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/18 20:06:00 UTC

[jira] [Commented] (RYA-294) Implement owl:someValuesFrom inference

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

Jesse Hatfield commented on RYA-294:
------------------------------------

h4. Logic, Limitations
If we have{quote}:A owl:onProperty \:p .
:A owl:someValuesFrom :B .{quote}
then this means:
{quote}(x is an A) *if and only if* there exists some y *such that* (y is a B) AND (x p y) .{quote}
Or:
{quote}(1) *If* there exists some y *such that* (y is a B) AND (x p y) *then* x is an A .
(2) *If* x is an A *then* there exists some y such that (y is a B) AND (x p y) .{quote}
Under the OWL open-world semantics, the correct inference in (2) is that there is such an individual _y_, even if it isn't represented in the known data. Full reasoners infer that some unknown _y_ exists and consider the different individuals it might be, and also consider the possibility that it is some new individual that isn't explicitly represented in the data store. This is an example of the kind of non-deterministic implication that makes full reasoning computationally difficult. In theory, even if nothing were stated to have type B, a query such as {code}ASK \{ ?y rdf:type :B . \}{code}could use implication (2) to return true if there were any instance of A: if there is an A, then it must be connected to some individual who has type B. But we have no way of knowing what that individual might be, so the query {code}SELECT ?y \{ ?y rdf:type :B .\}{code}wouldn't be able to return any specific instance. Non-deterministic implications are outside the scope of the current effort, so for now we only consider implication (1).
h4. Class Hierarchy
Ideally, other relationships between classes would be taken into account. For example, in the [actual LUBM schema|http://swat.cse.lehigh.edu/onto/univ-bench.owl], we have:
{code}lubm:Chair owl:intersectionOf (
    lubm:Person
    [ a owl:Restriction ; owl:onProperty lubm:headOf ; owl:someValuesFrom lubm:Department ]
) .
lubm:Chair rdfs:subClassOf lubm:Profesor .{code}
In general, Rya's application of multiple inference rules is limited: the visitors will skip any joins produced by other visitors. Long-term, we may want to investigate relaxing that restriction to account for classes like the above. In the meantime, I propose we at least take subclasses into account with respect to the type of the property restriction itself, so if A is declared to be a superclass (or once this is implemented, equivalent class) of the someValuesFrom expression, we can infer membership in A from a value of the appropriate type.

That is, if the ontology states:
{code}[ owl:onProperty :p ; owl:someValuesFrom :B ] rdfs:subClassOf :A .
[ owl:onProperty :q ; owl:someValuesFrom :C ] rdfs:subClassOf :A .{code}
Then a query:
{code}SELECT ?x { ?x rdf:type :A . }{code}
Should be rewritten:
{code}SELECT ?x {
    {
        ?x :p ?y .
        ?y rdf:type :B .
    } UNION {
        ?x :q ?y .
        ?y rdf:type :C .
    } UNION {
        ?x rdf:type :A .
    }
}{code}
For now, the individual joins won't be further expanded (e.g. if q has an inverse property or B has subclasses), but we'll likely want to consider doing so to some extent eventually.

h4. Pseudocode

As with most inference rules, we'll need the inference engine to process the schema at refresh time, and a query visitor to apply the rule at query time. In the inference engine, at refresh time:
{code}propertyRestrictions <- Map<type, property>{ restrictionType -> property; for query(?restrictionType owl:onProperty ?property) }
someValuesFromByRestrictionType <- Map<type, Map<property, valueType)>
for (restrictionType, property) in propertyRestrictions:
    for valueType in query(property owl:someValuesFrom ?valueType):
        someValuesFromByRestrictionType[restrictionType][property] <- valueType{code}
In the inference engine, provide method:
{code}getSomeValuesFromImplying(type): // return (property, value type) pairs that would imply this type
    results <- List<(property, valueType)>
    typesImplyingType <- type UNION getAllSubclasses(type)
    for sufficientType <- type UNION getAllSubClasses(type):
        if sufficientType in someValuesFromByRestrictionType:
            results.addAll(someValuesFromByRestrictionType[sufficientType])
    return results{code}
Then at query time, we need a visitor to transform statement patterns accordingly:
{code}meet(StatementPattern originalSP):
    if originalSP like (?subject rdf:type :C1): // Assume the type in question is explicitly given in the query, not a variable
        node <- originalSP
        for (property, valueType) in inferenceEngine.getSomeValuesFromImplying(C1):
            option <- InferJoin(StatementPattern(?subject, property, ?object), StatementPattern(?object, rdf:type, valueType))
            node <- InferUnion(node, option)
        originalSP.replaceWith(node){code}

> Implement owl:someValuesFrom inference
> --------------------------------------
>
>                 Key: RYA-294
>                 URL: https://issues.apache.org/jira/browse/RYA-294
>             Project: Rya
>          Issue Type: Sub-task
>          Components: sail
>            Reporter: Jesse Hatfield
>
> An *{{owl:someValuesFrom}}* restriction defines the set of resources which, for a given predicate and other type, have at least one value of that other type for that predicate.
> If the ontology states that {{:Chair}} is the set of resources who are {{:headOf}} at least one resource which must itself be a {{:Department}}, then:
> {{?x rdf:type :Chair}}
> should be expanded to:
> {noformat}
> { ?x :headOf ?dept .
>   ?dept rdf:type :Department  }
> UNION
> {?x rdf:type :Chair }
> {noformat}



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