[ https://issues.apache.org/jira/browse/RYA-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16084442#comment-16084442 ]
ASF GitHub Bot commented on RYA-291: ------------------------------------ Github user jessehatfield commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/174#discussion_r127032327 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -583,4 +625,69 @@ public boolean isSchedule() { public void setSchedule(boolean schedule) { this.schedule = schedule; } + + /** + * For a given type, return any properties and values such that owl:hasValue restrictions on + * those properties could imply this type. No matter how many restrictions are returned, each + * one is considered individually sufficient: if a resource has the property and the value, then + * it belongs to the provided type. Takes type hierarchy into account, so the value may imply a --- End diff -- If A were a superclass of B and C, rather than a subclass, then we would consider that individual to be of type A. This method is going to return all the hasValue restrictions on all of a type's subclasses, and since belonging to one subclass is sufficient to determine membership in the superclass, meeting one of those restrictions is also sufficient to determine membership in the superclass. Also keep in mind that hasValue property restrictions don't *require* any data to be there; they actually imply it: "x is a member of B <-> x has prop1=val1". So in your example, if an individual is known to be of type A, then it must also have types B and C, and it must also have prop1=val1 and prop2=val2. If those triples aren't in the data, that's OK, we can infer them (though that would be the other rewriting case and handled by the other method). The clearest statement of this in the standards is probably [here](https://www.w3.org/TR/owl2-profiles/#Reasoning_in_OWL_2_RL_and_RDF_Graphs_using_Rules), specifically cls-hv1 and cls-hv2 in table 6. (This list of rules is incomplete since it only covers OWL RL languages, but the terms it does cover have their standard meaning.) > Implement owl:hasValue inference > -------------------------------- > > Key: RYA-291 > URL: https://issues.apache.org/jira/browse/RYA-291 > Project: Rya > Issue Type: Sub-task > Components: sail > Reporter: Jesse Hatfield > Assignee: Jesse Hatfield > > *{{owl:hasValue}}* is used to define a property restriction representing the > set of resources with a specific value for a specific predicate. > If the ontology states that the class {{:ChildOfJohn}} represents all > resources with {{:parent}} equal to {{:John}}, then the inference engine > should be able to: > 1. Rewrite a query pattern {{?X rdf:type :ChildOfJohn}} to check for > resources whose {{:parent}} is {{:John}} (in addition to those explicitly > stated to have type {{:ChildOfJohn}}) > 2. Rewrite a query pattern {{:Jane :parent :?Y}} to check whether :Jane has > the type {{:ChildOfJohn}} (in addition to querying for any specifically > stated {{:parent}} s) -- This message was sent by Atlassian JIRA (v6.4.14#64029)