[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-18 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user asfgit closed the pull request at:

https://github.com/apache/incubator-rya/pull/197


> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-17 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user asfgit commented on the issue:

https://github.com/apache/incubator-rya/pull/197
  

Refer to this link for build results (access rights to CI server needed): 

https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/408/



> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-17 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user meiercaleb commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/197#discussion_r133815357
  
--- Diff: 
sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java 
---
@@ -363,13 +367,173 @@ public void refreshGraph() throws 
InferenceEngineException {
}
 }
 
+refreshDomainRange();
+
 refreshPropertyRestrictions();
 
 } catch (QueryEvaluationException e) {
 throw new InferenceEngineException(e);
 }
 }
 
+/**
+ * Queries domain and range information, then populates the inference 
engine with direct
+ * domain/range relations and any that can be inferred from the 
subclass graph, subproperty
+ * graph, and inverse property map. Should be called after that class 
and property information
+ * has been refreshed.
+ *
+ * Computes indirect domain/range:
+ *  - If p1 has domain c, and p2 is a subproperty of p1, then p2 also 
has domain c.
+ *  - If p1 has range c, and p2 is a subproperty of p1, then p2 also 
has range c.
+ *  - If p1 has domain c, and p2 is the inverse of p1, then p2 has 
range c.
+ *  - If p1 has range c, and p2 is the inverse of p1, then p2 has 
domain c.
+ *  - If p has domain c1, and c1 is a subclass of c2, then p also has 
domain c2.
+ *  - If p has range c1, and c1 is a subclass of c2, then p also has 
range c2.
+ * @throws QueryEvaluationException
+ */
+private void refreshDomainRange() throws QueryEvaluationException {
+Map> domainByTypePartial = new ConcurrentHashMap<>();
+Map> rangeByTypePartial = new ConcurrentHashMap<>();
+// First, populate domain and range based on direct domain/range 
triples.
+CloseableIteration iter = 
RyaDAOHelper.query(ryaDAO, null, RDFS.DOMAIN, null, conf);
+try {
+while (iter.hasNext()) {
--- End diff --

It seems like this map building loop is extremely prevalent in the refresh 
methods for all of the property restrictions.  Is there any way to pull this 
logic out into a buildRestrictionMap(...) method that takes in the map that is 
being updated/created/refreshed, and/or the iterator/property URI used to 
create the iterator?


> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-17 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user meiercaleb commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/197#discussion_r133814275
  
--- Diff: 
sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java 
---
@@ -73,6 +74,8 @@
 private Set transitivePropertySet;
 private Map> hasValueByType;
 private Map> hasValueByProperty;
+private Map> domainByType;
--- End diff --

Can one of you create a ticket for this?  The solution of this is probably 
not within the scope of this task, but this should be resolved.


> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-14 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user asfgit commented on the issue:

https://github.com/apache/incubator-rya/pull/197
  

Refer to this link for build results (access rights to CI server needed): 

https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/389/



> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-14 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user jessehatfield commented on the issue:

https://github.com/apache/incubator-rya/pull/197
  
Updated. At some point it would be nice to make a pass over the inference 
engine for thread-safety across both the old and new logic, maybe once the 
currently-pending extensions are added.


> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-10 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user ejwhite922 commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/197#discussion_r132466881
  
--- Diff: 
sail/src/test/java/org/apache/rya/rdftriplestore/inference/DomainRangeVisitorTest.java
 ---
@@ -0,0 +1,140 @@
+package org.apache.rya.rdftriplestore.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.
+ */
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Stack;
+
+import org.apache.rya.accumulo.AccumuloRdfConfiguration;
+import org.apache.rya.rdftriplestore.utils.FixedStatementPattern;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openrdf.model.Resource;
+import org.openrdf.model.Statement;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.ValueFactoryImpl;
+import org.openrdf.model.vocabulary.RDF;
+import org.openrdf.model.vocabulary.RDFS;
+import org.openrdf.query.algebra.Join;
+import org.openrdf.query.algebra.Projection;
+import org.openrdf.query.algebra.ProjectionElem;
+import org.openrdf.query.algebra.ProjectionElemList;
+import org.openrdf.query.algebra.StatementPattern;
+import org.openrdf.query.algebra.TupleExpr;
+import org.openrdf.query.algebra.Union;
+import org.openrdf.query.algebra.Var;
+
+public class DomainRangeVisitorTest {
+private final AccumuloRdfConfiguration conf = new 
AccumuloRdfConfiguration();
+private final ValueFactory vf = new ValueFactoryImpl();
+private final URI person = vf.createURI("lubm:Person");
--- End diff --

These URI's can be made static final


> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-10 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user ejwhite922 commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/197#discussion_r132466657
  
--- Diff: 
sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java 
---
@@ -73,6 +74,8 @@
 private Set transitivePropertySet;
 private Map> hasValueByType;
 private Map> hasValueByProperty;
+private Map> domainByType;
--- End diff --

We should probably start using ConcurrentHashMaps for all these maps.  The 
InferenceEngine is not very thread safe right now.


> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-10 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user ejwhite922 commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/197#discussion_r132463450
  
--- Diff: 
sail/src/test/java/org/apache/rya/rdftriplestore/inference/DomainRangeVisitorTest.java
 ---
@@ -0,0 +1,140 @@
+package org.apache.rya.rdftriplestore.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.
+ */
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.Stack;
+
+import org.apache.rya.accumulo.AccumuloRdfConfiguration;
+import org.apache.rya.rdftriplestore.utils.FixedStatementPattern;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openrdf.model.Resource;
+import org.openrdf.model.Statement;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.ValueFactoryImpl;
+import org.openrdf.model.vocabulary.RDF;
+import org.openrdf.model.vocabulary.RDFS;
+import org.openrdf.query.algebra.Join;
+import org.openrdf.query.algebra.Projection;
+import org.openrdf.query.algebra.ProjectionElem;
+import org.openrdf.query.algebra.ProjectionElemList;
+import org.openrdf.query.algebra.StatementPattern;
+import org.openrdf.query.algebra.TupleExpr;
+import org.openrdf.query.algebra.Union;
+import org.openrdf.query.algebra.Var;
+
+public class DomainRangeVisitorTest {
+private final AccumuloRdfConfiguration conf = new 
AccumuloRdfConfiguration();
+private final ValueFactory vf = new ValueFactoryImpl();
+private final URI person = vf.createURI("lubm:Person");
+private final URI advisor = vf.createURI("lubm:advisor");
+private final URI takesCourse = vf.createURI("lubm:takesCourse");
+
+@Test
+public void testRewriteTypePattern() throws Exception {
+final InferenceEngine inferenceEngine = 
mock(InferenceEngine.class);
+final Set domainPredicates = new HashSet<>();
+final Set rangePredicates = new HashSet<>();
+domainPredicates.add(advisor);
+domainPredicates.add(takesCourse);
+rangePredicates.add(advisor);
+
when(inferenceEngine.getPropertiesWithDomain(person)).thenReturn(domainPredicates);
+
when(inferenceEngine.getPropertiesWithRange(person)).thenReturn(rangePredicates);
+final Var subjVar = new Var("s");
+final StatementPattern originalSP = new StatementPattern(subjVar, 
new Var("p", RDF.TYPE), new Var("o", person));
+final Projection query = new Projection(originalSP, new 
ProjectionElemList(new ProjectionElem("s", "subject")));
+new DomainRangeVisitor(conf, inferenceEngine).meet(query);
--- End diff --

Should this be query.visit(new DomainRangeVisitor(conf, inferenceEngine))?  
Or does it not matter?


> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user asfgit commented on the issue:

https://github.com/apache/incubator-rya/pull/197
  

Refer to this link for build results (access rights to CI server needed): 

https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/355/



> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


Github user jessehatfield commented on the issue:

https://github.com/apache/incubator-rya/pull/197
  
Note that the results of a domain/range query can be huge, and hugely 
redundant, because: A) there can be many predicates inferring the same type, 
and we'll query for all of them; and B) even for one predicate, we'll generate 
a result for each instance of that predicate even if we end up inferring the 
same resource's type many times. (E.g. in a LUBM dataset, querying for all 
universities will give you the same solution of :University0 for every triple 
.) Wrapping the query in a Distinct 
introduces its own computational costs, so the decision to do that is left to 
the caller.

Some optimizations could be possible if we knew we were starting with a 
relatively small set of candidates: Asking "does this have the type?" for each 
candidate could be faster than asking for all the ways of inferring the type. 
But that optimization is more general than just domain and range queries (and 
could potentially be generalized even further), so I'd consider something like 
that outside the scope of this problem.


> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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


[jira] [Commented] (RYA-298) Implement rdfs:domain inference

2017-08-04 Thread ASF GitHub Bot (JIRA)

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

ASF GitHub Bot commented on RYA-298:


GitHub user jessehatfield opened a pull request:

https://github.com/apache/incubator-rya/pull/197

RYA-298, RYA-299 Domain/range inference.


## Description
InferenceEngine: Added a method to query for and infer domain/range schema, 
incorporating subclass, subproperty, and inverse property information to 
compute the closure. Extended graph traversal methods to allow traversal in 
each direction (findParents has the same behavior as before, but is joined by 
findChildren, both of which call findConnections with a direction parameter).

DomainRangeVisitor: New class rewrites queries for members of a specific 
defined type to check for domain and range implications as well. Applies to 
StatementPatterns of the form , where Class is not a variable, and 
produces (if domain and/or range exist for that type) a union which includes 
the original pattern as well.

RdfCloudTripleStoreConnection: Call the DomainRangeVisitor if inference is 
enabled. Called at the beginning of the sequence of visitors because the 
original statement is preserved as one branch of the union, so this won't stop 
other inference rules from being applied in that branch. However, as with the 
other visitors, the inferred branches of the unions won't be expanded. This 
means we won't infer the type by applying multiple rules at once (regardless of 
order of visitor calls), but we will have a union of alternative ways of 
inferring the type.

### Tests
Added tests to: Verify that InferenceEngine loads and infers expected 
schema (taking into account class hierarchy, property graph, and inverse 
properties); verify that the visitor produces the expected query tree; and 
verify that a type query returns the expected results given an ontology.

### Links
[RYA-298](https://issues.apache.org/jira/browse/RYA-298)
[RYA-299](https://issues.apache.org/jira/browse/RYA-299)

### Checklist
- [ ] Code Review
- [ ] Squash Commits

 People To Reivew
@meiercaleb 
@ejwhite922 
@pujav65
@amihalik 

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/jessehatfield/incubator-rya 
RYA-298-299-domain-range-inference

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/incubator-rya/pull/197.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 #197


commit 36d8f752da4a3c5e8d7ebbbcb790ec0117c790ea
Author: Jesse Hatfield 
Date:   2017-08-04T17:05:45Z

RYA-298, RYA-299 Domain/range inference.




> Implement rdfs:domain inference
> ---
>
> Key: RYA-298
> URL: https://issues.apache.org/jira/browse/RYA-298
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Jesse Hatfield
>
> If a predicate has an *{{rdfs:domain}}* of some class, than the subject of 
> any triple including that predicate belongs to the class.
> If the ontology states that {{:advisor}} has the domain of {{:Person}}, then 
> the inference engine should rewrite queries of the form {{?x rdf:type 
> :Person}} to check for resources which have any {{:advisor}} (as well as any 
> specifically stated to have type {{:Person}} ).



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