GitHub user jessehatfield opened a pull request:
https://github.com/apache/incubator-rya/pull/217
RYA-294 owl:someValuesFrom inference
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
## Description
Inference applies owl:someValuesFrom semantics for queries including
statement patterns of the form "?x rdf:type :DefinedClass".
An owl:someValuesFrom property restriction is an existential class
expression: it defines type T1 to be the set of individuals, such that, for a
given property p and type T2, there is at least one value of type T2 for that
property, i.e. for any subject belonging to T1 there exists a triple whose
predicate is p and whose object belongs to T2. Therefore, if an individual is
known to belong to the value type (T2), then any individual having it as a
value for property p by definition belongs to T1. This is similar to
rdfs:domain except that it only applies when the object of the triple belongs
to the appropriate class expression. It is the converse of owl:allValuesFrom,
in which the subject's type and the predicate are used to infer the object's
type.
(It's also theoretically true that if something belongs to the set defined
by owl:someValuesFrom, then there must exist some individual which is the value
and belongs to that type. But we don't have a direct way to use that
implication to answer queries, so it is ignored for now.)
InferenceEngine stores someValuesFrom information nearly identically to
allValuesFrom information, except that it can be accessed by the type of the
restriction rather than the type of the value. Some edits to allValuesFrom
logic for consistency/simplicity/reuse.
SomeValuesFromVisitor processes statement patterns of the form "?x rdf:type
:T1", and if :T2 is the type of an owl:someValuesFrom restriction according to
the inference engine, it replaces the statement pattern with a union: of 1) the
same statement pattern; and 2) a subquery of the form "?y rdf:type :T2. ?x :p
?y." for the appropriate (restriction type, property) pairs.
RdfCloudTripleStoreConnection adds this to its list of visitors to call on
a query.
Added an example to MongoRyaDirectExample, using a slightly modified piece
of the LUBM example schema (can't use the exact formulation from LUBM because
it relies on composing intersection and property restriction logic, where Rya
will not presently apply both).
### Tests
Unit test to verify that InferenceEngine stores and returns the schema;
unit test to verify that type queries are rewritten appropriately; integration
test to verify correct results for sample ontology+instances+query.
### Links
[Jira](https://issues.apache.org/jira/browse/RYA-294)
### Checklist
- [ ] Code Review
- [ ] Squash Commits
#### People To Reivew
@meiercaleb @ejwhite922 @isper3at @pujav65
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jessehatfield/incubator-rya
RYA-294-someValuesFrom-inference
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-rya/pull/217.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #217
----
commit 870bc57f909cb76ed9603ad2a27ff9824e4be0c7
Author: Jesse Hatfield <[email protected]>
Date: 2017-08-24T01:14:48Z
RYA-294 owl:someValuesFrom inference
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---