GitHub user jessehatfield opened a pull request:
https://github.com/apache/incubator-rya/pull/201
RYA-295 owl:allValuesFrom 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:allValuesFrom semantics for queries including
statement patterns of the form "?x rdf:type :DefinedClass".
An owl:allValuesFrom property restriction is a universal class expression:
it defines type T1 to be the set of individuals such that, for a given property
p and type T2, all values of that property (i.e. all objects of triples where
the predicate is p and the subject belongs to T1) have type T2. Therefore, if
an individual is known to belong to the universal class expression (T1), then
it can be inferred that all of its values for the property belong to the value
type (T2). This is similar to rdfs:range except that it only applies when the
subject of the triple belongs to the appropriate class expression.
InferenceEngine, at refresh time, stores information about
owl:allValuesFrom restrictions (universal class expressions). These definitions
can then be accessed by the value type: getAllValuesFromByValueType(<value
type>) returns every (restriction type, property) pair.
AllValuesFromVisitor processes statement patterns of the form "?x rdf:type
:T2", and if :T2 is the value type for any owl:allValuesFrom restriction
according to the inference engine, it replaces the statement pattern with a
union: of 1) that same statement pattern (in case the type is explicitly
asserted or can be inferred by some other rule); and 2) a subquery of the form
"?y \:p ?x . ?y rdf:type :T1" for the appropriate (restriction type, property)
pair.
RdfCloudTripleStoreConnection calls the visitor along with the other
inference logic. Because the original statement pattern is preserved as one
branch of the union, other visitors can still apply if there are other ways to
derive the type.
Added a simple example of a query that relies on this inference to
MongoRyaDirectExample.
### Tests
Unit test to verify that InferenceEngine stores and returns the schema;
unit test to verify that AllValuesFromVisitor rewrites queries of the proper
form; integration test to verify correct results for sample
ontology+instances+query relying on allValuesFrom inference.
### Links
[Jira](https://issues.apache.org/jira/browse/RYA-295)
### Checklist
- [ ] Code Review
- [ ] Squash Commits
#### People To Reivew
@ejwhite922
@isper3at
@meiercaleb
@pujav65
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/jessehatfield/incubator-rya
RYA-295-allValuesFrom-inference
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-rya/pull/201.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 #201
----
commit 55eae37e2f4aaef2f8cd41c735241c2ae85b88af
Author: Jesse Hatfield <[email protected]>
Date: 2017-08-08T19:58:10Z
RYA-295 owl:allValuesFrom 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.
---