You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rya.apache.org by ca...@apache.org on 2017/09/01 16:52:06 UTC

incubator-rya git commit: RYA-301 owl:ReflexiveProperty inference. Closes #218.

Repository: incubator-rya
Updated Branches:
  refs/heads/master 38a1ffd9a -> ad6ab0185


RYA-301 owl:ReflexiveProperty inference. Closes #218.


Project: http://git-wip-us.apache.org/repos/asf/incubator-rya/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-rya/commit/ad6ab018
Tree: http://git-wip-us.apache.org/repos/asf/incubator-rya/tree/ad6ab018
Diff: http://git-wip-us.apache.org/repos/asf/incubator-rya/diff/ad6ab018

Branch: refs/heads/master
Commit: ad6ab0185c1246aac5cab8bd5dc27f5c0a578a8d
Parents: 38a1ffd
Author: Jesse Hatfield <je...@parsons.com>
Authored: Mon Aug 28 18:46:02 2017 -0400
Committer: Caleb Meier <ca...@parsons.com>
Committed: Fri Sep 1 09:48:16 2017 -0700

----------------------------------------------------------------------
 .../api/RdfCloudTripleStoreConfiguration.java   | 200 ++++++++++++++++++-
 .../RdfCloudTripleStoreConnection.java          |   2 +
 .../inference/AllValuesFromVisitor.java         |   4 +-
 .../inference/DomainRangeVisitor.java           |   4 +-
 .../inference/HasSelfVisitor.java               |   4 +-
 .../inference/HasValueVisitor.java              |   4 +-
 .../inference/InferenceEngine.java              |  59 +++---
 .../inference/PropertyChainVisitor.java         |   2 +-
 .../inference/ReflexivePropertyVisitor.java     |  73 +++++++
 .../rdftriplestore/inference/SameAsVisitor.java |   2 +-
 .../inference/InferenceEngineTest.java          |  41 ++++
 .../rdftriplestore/inference/InferenceIT.java   |  76 +++++++
 .../inference/PropertyChainTest.java            | 140 +++++++++++++
 .../inference/ReflexivePropertyVisitorTest.java |  91 +++++++++
 .../rdftriplestore/inference/SameAsTest.java    | 115 +++++++++++
 .../inference/PropertyChainTest.java            | 140 -------------
 .../rya/triplestore/inference/SameAsTest.java   | 115 -----------
 17 files changed, 770 insertions(+), 302 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/common/rya.api/src/main/java/org/apache/rya/api/RdfCloudTripleStoreConfiguration.java
----------------------------------------------------------------------
diff --git a/common/rya.api/src/main/java/org/apache/rya/api/RdfCloudTripleStoreConfiguration.java b/common/rya.api/src/main/java/org/apache/rya/api/RdfCloudTripleStoreConfiguration.java
index ed120ef..a837b4e 100644
--- a/common/rya.api/src/main/java/org/apache/rya/api/RdfCloudTripleStoreConfiguration.java
+++ b/common/rya.api/src/main/java/org/apache/rya/api/RdfCloudTripleStoreConfiguration.java
@@ -72,15 +72,21 @@ public abstract class RdfCloudTripleStoreConfiguration extends Configuration {
     public static final String CONF_STATEMENT_METADATA_PROPERTIES = "statement.metadata.properites";
     public static final String CONF_USE_STATEMENT_METADATA = "use.statement.metadata";
     public static final String STATS_PUSH_EMPTY_RDFTYPE_DOWN = "conf.stats.rdftype.down";
+    public static final String INFER_INCLUDE_ALL_VALUES_FROM = "infer.include.allvaluesfrom";
+    public static final String INFER_INCLUDE_DOMAIN_RANGE = "infer.include.domainrange";
+    public static final String INFER_INCLUDE_HAS_SELF = "infer.include.hasself";
+    public static final String INFER_INCLUDE_HAS_VALUE = "infer.include.hasvalue";
     public static final String INFER_INCLUDE_INTERSECTION_OF = "infer.include.intersectionof";
     public static final String INFER_INCLUDE_INVERSEOF = "infer.include.inverseof";
     public static final String INFER_INCLUDE_ONE_OF = "infer.include.oneof";
+    public static final String INFER_INCLUDE_PROPERTY_CHAIN = "infer.include.propertychain";
+    public static final String INFER_INCLUDE_REFLEXIVE_PROP = "infer.include.reflexiveprop";
     public static final String INFER_INCLUDE_SOME_VALUES_FROM = "infer.include.somevaluesfrom";
+    public static final String INFER_INCLUDE_SAME_AS = "infer.include.sameas";
     public static final String INFER_INCLUDE_SUBCLASSOF = "infer.include.subclassof";
     public static final String INFER_INCLUDE_SUBPROPOF = "infer.include.subpropof";
     public static final String INFER_INCLUDE_SYMMPROP = "infer.include.symmprop";
     public static final String INFER_INCLUDE_TRANSITIVEPROP = "infer.include.transprop";
-    public static final String INFER_INCLUDE_HAS_SELF = "infer.include.hasself";
 
     public static final String RDF_DAO_CLASS = "class.rdf.dao";
     public static final String RDF_EVAL_STATS_DAO_CLASS = "class.rdf.evalstats";
@@ -334,6 +340,82 @@ public abstract class RdfCloudTripleStoreConfiguration extends Configuration {
     }
 
     /**
+     * @return {@code true} if owl:allValuesFrom inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
+    public Boolean isInferAllValuesFrom() {
+        return getBoolean(INFER_INCLUDE_ALL_VALUES_FROM, true);
+    }
+
+    /**
+     * Sets whether owl:allValuesFrom inferencing is enabled or disabled.
+     * @param value {@code true} if owl:allValuesFrom inferencing is enabled.
+     * {@code false} otherwise.
+     */
+    public void setInferAllValuesFrom(final Boolean value) {
+        Preconditions.checkNotNull(value);
+        setBoolean(INFER_INCLUDE_ALL_VALUES_FROM, value);
+    }
+
+    /**
+     * @return {@code true} if rdfs:domain and rdfs:range inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
+    public Boolean isInferDomainRange() {
+        return getBoolean(INFER_INCLUDE_DOMAIN_RANGE, true);
+    }
+
+    /**
+     * Sets whether rdfs:domain and rdfs:range inferencing is enabled or disabled.
+     * @param value {@code true} if rdfs:domain/range inferencing is enabled.
+     * {@code false} otherwise.
+     */
+    public void setInferDomainRange(final Boolean val) {
+        Preconditions.checkNotNull(val);
+        setBoolean(INFER_INCLUDE_DOMAIN_RANGE, val);
+    }
+
+    /**
+     * @return {@code true} if owl:hasSelf inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
+    public Boolean isInferHasSelf() {
+        return getBoolean(INFER_INCLUDE_HAS_SELF, true);
+    }
+
+    /**
+     * Sets whether owl:hasSelf inferencing is enabled or disabled.
+     * @param value {@code true} if owl:hasSelf inferencing is enabled.
+     * {@code false} otherwise.
+     */
+    public void setInferHasSelf(final Boolean val) {
+        Preconditions.checkNotNull(val);
+        setBoolean(INFER_INCLUDE_HAS_SELF, val);
+    }
+
+    /**
+     * @return {@code true} if owl:hasValue inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
+    public Boolean isInferHasValue() {
+        return getBoolean(INFER_INCLUDE_HAS_VALUE, true);
+    }
+
+    /**
+     * Sets whether owl:hasValue inferencing is enabled or disabled.
+     * @param value {@code true} if owl:hasValue inferencing is enabled.
+     * {@code false} otherwise.
+     */
+    public void setInferHasValue(final Boolean value) {
+        Preconditions.checkNotNull(value);
+        setBoolean(INFER_INCLUDE_HAS_VALUE, value);
+    }
+
+    /**
      * @return {@code true} if owl:intersectionOf inferencing is enabled.
      * {@code false} otherwise. Defaults to {@code true} if nothing is
      * specified.
@@ -352,10 +434,20 @@ public abstract class RdfCloudTripleStoreConfiguration extends Configuration {
         setBoolean(INFER_INCLUDE_INTERSECTION_OF, value);
     }
 
+    /**
+     * @return {@code true} if owl:inverseOf inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
     public Boolean isInferInverseOf() {
         return getBoolean(INFER_INCLUDE_INVERSEOF, true);
     }
 
+    /**
+     * Sets whether owl:inverseOf inferencing is enabled or disabled.
+     * @param value {@code true} if owl:inverseOf inferencing is enabled.
+     * {@code false} otherwise.
+     */
     public void setInferInverseOf(final Boolean val) {
         Preconditions.checkNotNull(val);
         setBoolean(INFER_INCLUDE_INVERSEOF, val);
@@ -381,6 +473,63 @@ public abstract class RdfCloudTripleStoreConfiguration extends Configuration {
     }
 
     /**
+     * @return {@code true} if owl:propertyChainAxiom inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
+    public Boolean isInferPropertyChain() {
+        return getBoolean(INFER_INCLUDE_PROPERTY_CHAIN, true);
+    }
+
+    /**
+     * Sets whether owl:propertyChainAxiom inferencing is enabled or disabled.
+     * @param value {@code true} if owl:propertyChainAxiom inferencing is
+     * enabled. {@code false} otherwise.
+     */
+    public void setInferPropertyChain(final Boolean value) {
+        Preconditions.checkNotNull(value);
+        setBoolean(INFER_INCLUDE_PROPERTY_CHAIN, value);
+    }
+
+    /**
+     * @return {@code true} if owl:ReflexiveProperty inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
+    public Boolean isInferReflexiveProperty() {
+        return getBoolean(INFER_INCLUDE_REFLEXIVE_PROP, true);
+    }
+
+    /**
+     * Sets whether owl:ReflexiveProperty inferencing is enabled or disabled.
+     * @param value {@code true} if owl:ReflexiveProperty inferencing is
+     * enabled. {@code false} otherwise.
+     */
+    public void setInferReflexiveProperty(final Boolean value) {
+        Preconditions.checkNotNull(value);
+        setBoolean(INFER_INCLUDE_REFLEXIVE_PROP, value);
+    }
+
+    /**
+     * @return {@code true} if owl:sameAs inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
+    public Boolean isInferSameAs() {
+        return getBoolean(INFER_INCLUDE_SAME_AS, true);
+    }
+
+    /**
+     * Sets whether owl:sameAs inferencing is enabled or disabled.
+     * @param value {@code true} if owl:sameAs inferencing is enabled.
+     * {@code false} otherwise.
+     */
+    public void setInferSameAs(final Boolean value) {
+        Preconditions.checkNotNull(value);
+        setBoolean(INFER_INCLUDE_SAME_AS, value);
+    }
+
+    /**
      * @return {@code true} if owl:someValuesFrom inferencing is enabled.
      * {@code false} otherwise. Defaults to {@code true} if nothing is
      * specified.
@@ -399,46 +548,77 @@ public abstract class RdfCloudTripleStoreConfiguration extends Configuration {
         setBoolean(INFER_INCLUDE_SOME_VALUES_FROM, value);
     }
 
+    /**
+     * @return {@code true} if rdfs:subClassOf inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
     public Boolean isInferSubClassOf() {
         return getBoolean(INFER_INCLUDE_SUBCLASSOF, true);
     }
 
+    /**
+     * Sets whether rdfs:subClassOf inferencing is enabled or disabled.
+     * @param value {@code true} if rdfs:subClassOf inferencing is enabled.
+     * {@code false} otherwise.
+     */
     public void setInferSubClassOf(final Boolean val) {
         Preconditions.checkNotNull(val);
         setBoolean(INFER_INCLUDE_SUBCLASSOF, val);
     }
 
+    /**
+     * @return {@code true} if rdfs:subPropertyOf inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
     public Boolean isInferSubPropertyOf() {
         return getBoolean(INFER_INCLUDE_SUBPROPOF, true);
     }
 
+    /**
+     * Sets whether rdfs:subPropertyOf inferencing is enabled or disabled.
+     * @param value {@code true} if rdfs:subPropertyOf inferencing is enabled.
+     * {@code false} otherwise.
+     */
     public void setInferSubPropertyOf(final Boolean val) {
         Preconditions.checkNotNull(val);
         setBoolean(INFER_INCLUDE_SUBPROPOF, val);
     }
 
-    public Boolean hasSelf() {
-        return getBoolean(INFER_INCLUDE_HAS_SELF, true);
-    }
-
-    public void setHasSelf(final Boolean val) {
-        Preconditions.checkNotNull(val);
-        setBoolean(INFER_INCLUDE_HAS_SELF, val);
-    }
-
+    /**
+     * @return {@code true} if owl:SymmetricProperty inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
     public Boolean isInferSymmetricProperty() {
         return getBoolean(INFER_INCLUDE_SYMMPROP, true);
     }
 
+    /**
+     * Sets whether owl:SymmetricProperty inferencing is enabled or disabled.
+     * @param value {@code true} if owl:SymmetricProperty inferencing is enabled.
+     * {@code false} otherwise.
+     */
     public void setInferSymmetricProperty(final Boolean val) {
         Preconditions.checkNotNull(val);
         setBoolean(INFER_INCLUDE_SYMMPROP, val);
     }
 
+    /**
+     * @return {@code true} if owl:TransitiveProperty inferencing is enabled.
+     * {@code false} otherwise. Defaults to {@code true} if nothing is
+     * specified.
+     */
     public Boolean isInferTransitiveProperty() {
         return getBoolean(INFER_INCLUDE_TRANSITIVEPROP, true);
     }
 
+    /**
+     * Sets whether owl:TransitiveProperty inferencing is enabled or disabled.
+     * @param value {@code true} if owl:TransitiveProperty inferencing is enabled.
+     * {@code false} otherwise.
+     */
     public void setInferTransitiveProperty(final Boolean val) {
         Preconditions.checkNotNull(val);
         setBoolean(INFER_INCLUDE_TRANSITIVEPROP, val);

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/RdfCloudTripleStoreConnection.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/RdfCloudTripleStoreConnection.java b/sail/src/main/java/org/apache/rya/rdftriplestore/RdfCloudTripleStoreConnection.java
index 212fb2a..bf655ce 100644
--- a/sail/src/main/java/org/apache/rya/rdftriplestore/RdfCloudTripleStoreConnection.java
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/RdfCloudTripleStoreConnection.java
@@ -60,6 +60,7 @@ import org.apache.rya.rdftriplestore.inference.IntersectionOfVisitor;
 import org.apache.rya.rdftriplestore.inference.InverseOfVisitor;
 import org.apache.rya.rdftriplestore.inference.OneOfVisitor;
 import org.apache.rya.rdftriplestore.inference.PropertyChainVisitor;
+import org.apache.rya.rdftriplestore.inference.ReflexivePropertyVisitor;
 import org.apache.rya.rdftriplestore.inference.SameAsVisitor;
 import org.apache.rya.rdftriplestore.inference.SomeValuesFromVisitor;
 import org.apache.rya.rdftriplestore.inference.SubClassOfVisitor;
@@ -359,6 +360,7 @@ public class RdfCloudTripleStoreConnection extends SailConnectionBase {
                     tupleExpr.visit(new AllValuesFromVisitor(queryConf, inferenceEngine));
                     tupleExpr.visit(new HasValueVisitor(queryConf, inferenceEngine));
                     tupleExpr.visit(new IntersectionOfVisitor(queryConf, inferenceEngine));
+                    tupleExpr.visit(new ReflexivePropertyVisitor(queryConf, inferenceEngine));
                     tupleExpr.visit(new PropertyChainVisitor(queryConf, inferenceEngine));
                     tupleExpr.visit(new TransitivePropertyVisitor(queryConf, inferenceEngine));
                     tupleExpr.visit(new SymmetricPropertyVisitor(queryConf, inferenceEngine));

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/inference/AllValuesFromVisitor.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/AllValuesFromVisitor.java b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/AllValuesFromVisitor.java
index 9fc297a..26ae289 100644
--- a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/AllValuesFromVisitor.java
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/AllValuesFromVisitor.java
@@ -58,13 +58,13 @@ import org.openrdf.query.algebra.Var;
 public class AllValuesFromVisitor extends AbstractInferVisitor {
 
     /**
-     * Creates a new {@link AllValuesFromVisitor}, which is enabled by default.
+     * Creates a new {@link AllValuesFromVisitor}.
      * @param conf The {@link RdfCloudTripleStoreConfiguration}.
      * @param inferenceEngine The InferenceEngine containing the relevant ontology.
      */
     public AllValuesFromVisitor(RdfCloudTripleStoreConfiguration conf, InferenceEngine inferenceEngine) {
         super(conf, inferenceEngine);
-        include = true;
+        include = conf.isInferAllValuesFrom();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/inference/DomainRangeVisitor.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/DomainRangeVisitor.java b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/DomainRangeVisitor.java
index f97e396..6445286 100644
--- a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/DomainRangeVisitor.java
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/DomainRangeVisitor.java
@@ -50,13 +50,13 @@ import org.openrdf.query.algebra.Var;
  */
 public class DomainRangeVisitor extends AbstractInferVisitor {
     /**
-     * Creates a new {@link DomainRangeVisitor}, which is enabled by default.
+     * Creates a new {@link DomainRangeVisitor}.
      * @param conf The {@link RdfCloudTripleStoreConfiguration}.
      * @param inferenceEngine The InferenceEngine containing the relevant ontology.
      */
     public DomainRangeVisitor(RdfCloudTripleStoreConfiguration conf, InferenceEngine inferenceEngine) {
         super(conf, inferenceEngine);
-        include = true;
+        include = conf.isInferDomainRange();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasSelfVisitor.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasSelfVisitor.java b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasSelfVisitor.java
index 6776387..3077eb4 100644
--- a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasSelfVisitor.java
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasSelfVisitor.java
@@ -50,13 +50,13 @@ public class HasSelfVisitor extends AbstractInferVisitor {
     private static final Var TYPE_VAR = new Var(RDF.TYPE.stringValue(), RDF.TYPE);
 
     /**
-     * Creates a new {@link HasSelfVisitor}, which is enabled by default.
+     * Creates a new {@link HasSelfVisitor}.
      * @param conf The {@link RdfCloudTripleStoreConfiguration}.
      * @param inferenceEngine The InferenceEngine containing the relevant ontology.
      */
     public HasSelfVisitor(final RdfCloudTripleStoreConfiguration conf, final InferenceEngine inferenceEngine) {
         super(conf, inferenceEngine);
-        include = conf.hasSelf();
+        include = conf.isInferHasSelf();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasValueVisitor.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasValueVisitor.java b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasValueVisitor.java
index a7e6bc2..43ca579 100644
--- a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasValueVisitor.java
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasValueVisitor.java
@@ -71,13 +71,13 @@ import org.openrdf.query.algebra.Var;
  */
 public class HasValueVisitor extends AbstractInferVisitor {
     /**
-     * Creates a new {@link HasValueVisitor}, which is enabled by default.
+     * Creates a new {@link HasValueVisitor}.
      * @param conf The {@link RdfCloudTripleStoreConfiguration}.
      * @param inferenceEngine The InferenceEngine containing the relevant ontology.
      */
     public HasValueVisitor(RdfCloudTripleStoreConfiguration conf, InferenceEngine inferenceEngine) {
         super(conf, inferenceEngine);
-        include = true;
+        include = conf.isInferHasValue();
     }
 
     /**

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java
index 622ba33..23fda51 100644
--- a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java
@@ -75,12 +75,14 @@ public class InferenceEngine {
     private static final Logger log = Logger.getLogger(InferenceEngine.class);
     private static final ValueFactory VF = ValueFactoryImpl.getInstance();
     private static final URI HAS_SELF = VF.createURI(OWL.NAMESPACE, "hasSelf");
+    private static final URI REFLEXIVE_PROPERTY = VF.createURI(OWL.NAMESPACE, "ReflexiveProperty");
 
     private Graph subClassOfGraph;
     private Graph subPropertyOfGraph;
     private Set<URI> symmetricPropertySet;
     private Map<URI, URI> inverseOfMap;
     private Set<URI> transitivePropertySet;
+    private Set<URI> reflexivePropertySet;
     private Map<URI, Set<URI>> domainByType;
     private Map<URI, Set<URI>> rangeByType;
     private Map<Resource, Map<URI, Value>> hasValueByType;
@@ -211,33 +213,9 @@ public class InferenceEngine {
 
             refreshOneOf();
 
-            iter = RyaDAOHelper.query(ryaDAO, null, RDF.TYPE, OWL.SYMMETRICPROPERTY, conf);
-            final Set<URI> symProp = new HashSet<>();
-            try {
-                while (iter.hasNext()) {
-                    final Statement st = iter.next();
-                    symProp.add((URI) st.getSubject()); //safe to assume it is a URI?
-                }
-            } finally {
-                if (iter != null) {
-                    iter.close();
-                }
-            }
-            symmetricPropertySet = symProp;
-
-            iter = RyaDAOHelper.query(ryaDAO, null, RDF.TYPE, OWL.TRANSITIVEPROPERTY, conf);
-            final Set<URI> transProp = new HashSet<>();
-            try {
-                while (iter.hasNext()) {
-                    final Statement st = iter.next();
-                    transProp.add((URI) st.getSubject());
-                }
-            } finally {
-                if (iter != null) {
-                    iter.close();
-                }
-            }
-            transitivePropertySet = transProp;
+            symmetricPropertySet = fetchInstances(OWL.SYMMETRICPROPERTY);
+            transitivePropertySet = fetchInstances(OWL.TRANSITIVEPROPERTY);
+            reflexivePropertySet = fetchInstances(REFLEXIVE_PROPERTY);
 
             iter = RyaDAOHelper.query(ryaDAO, null, OWL.INVERSEOF, null, conf);
             final Map<URI, URI> invProp = new HashMap<>();
@@ -405,6 +383,24 @@ public class InferenceEngine {
     }
 
     /**
+     * Query for and collect all instances of a given type. Should only be called for types expected
+     * to have few members, such as ontology vocabulary terms, as instances will be collected in
+     * memory.
+     */
+    private Set<URI> fetchInstances(final URI type) throws QueryEvaluationException {
+        final Set<URI> instances = new HashSet<>();
+        ryaDaoQueryWrapper.queryAll(null, RDF.TYPE, type, new RDFHandlerBase() {
+            @Override
+            public void handleStatement(final Statement st) throws RDFHandlerException {
+                if (st.getSubject() instanceof URI) {
+                    instances.add((URI) st.getSubject());
+                }
+            }
+        });
+        return instances;
+    }
+
+    /**
      * Query for all triples involving a given predicate and add corresponding edges to a
      * {@link Graph} in one or both directions.
      * @param predicate Find all connections via this predicate URI
@@ -1179,6 +1175,15 @@ public class InferenceEngine {
     }
 
     /**
+     * Return whether a given property is known to be reflexive.
+     * @param prop A URI
+     * @return True if the given URI corresponds to an owl:ReflexiveProperty
+     */
+    public boolean isReflexiveProperty(final URI prop) {
+        return (reflexivePropertySet != null) && reflexivePropertySet.contains(prop);
+    }
+
+    /**
      * TODO: This chaining can be slow at query execution. the other option is to perform this in the query itself, but that will be constrained to how many levels we decide to go
      */
     public Set<Statement> findTransitiveProperty(final Resource subj, final URI prop, final Value obj, final Resource... contxts) throws InferenceEngineException {

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/inference/PropertyChainVisitor.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/PropertyChainVisitor.java b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/PropertyChainVisitor.java
index a966a46..251aa0c 100644
--- a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/PropertyChainVisitor.java
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/PropertyChainVisitor.java
@@ -42,7 +42,7 @@ public class PropertyChainVisitor extends AbstractInferVisitor {
 
     public PropertyChainVisitor(final RdfCloudTripleStoreConfiguration conf, final InferenceEngine inferenceEngine) {
         super(conf, inferenceEngine);
-        include = true;
+        include = conf.isInferPropertyChain();
     }
 
 

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/inference/ReflexivePropertyVisitor.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/ReflexivePropertyVisitor.java b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/ReflexivePropertyVisitor.java
new file mode 100644
index 0000000..d515bcf
--- /dev/null
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/ReflexivePropertyVisitor.java
@@ -0,0 +1,73 @@
+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 org.apache.rya.api.RdfCloudTripleStoreConfiguration;
+import org.openrdf.model.URI;
+import org.openrdf.query.algebra.StatementPattern;
+import org.openrdf.query.algebra.Var;
+import org.openrdf.query.algebra.ZeroLengthPath;
+
+/**
+ * Expands the query tree to account for any relevant reflexive properties
+ * known to the {@link InferenceEngine}.
+ *
+ * A reflexive property is a property for which any node can be inferred to have
+ * reflexively: If :p is a reflexive property, then <?x :p ?x> is true for all ?x.
+ *
+ * Applies to any statement pattern whose predicate is defined (not a variable)
+ * and is a reflexive property according to the InferenceEngine. If the property
+ * is reflexive, then the statement pattern should match when the subject equals
+ * the object. Therefore, replace the statement pattern with a union of itself
+ * and a ZeroLengthPath between the subject and object. This union is similar to
+ * the ZeroOrOnePath property path expression in SPARQL: <?x :p? ?y> matches if
+ * ?x and ?y are connected via :p or if ?x and ?y are equal.
+ */
+public class ReflexivePropertyVisitor extends AbstractInferVisitor {
+    /**
+     * Creates a new {@link ReflexivePropertyVisitor}.
+     * @param conf The {@link RdfCloudTripleStoreConfiguration}.
+     * @param inferenceEngine The InferenceEngine containing the relevant ontology.
+     */
+    public ReflexivePropertyVisitor(RdfCloudTripleStoreConfiguration conf, InferenceEngine inferenceEngine) {
+        super(conf, inferenceEngine);
+        include = conf.isInferReflexiveProperty();
+    }
+
+    /**
+     * Check whether any solution for the {@link StatementPattern} could be derived from
+     * reflexive property inference, and if so, replace the pattern with a union of itself and the
+     * reflexive solution.
+     */
+    @Override
+    protected void meetSP(StatementPattern node) throws Exception {
+        // Only applies when the predicate is defined and reflexive
+        final Var predVar = node.getPredicateVar();
+        if (predVar.getValue() != null && inferenceEngine.isReflexiveProperty((URI) predVar.getValue())) {
+            final StatementPattern originalSP = node.clone();
+            // The reflexive solution is a ZeroLengthPath between subject and
+            // object: they can be matched to one another, whether constants or
+            // variables.
+            final Var subjVar = node.getSubjectVar();
+            final Var objVar = node.getObjectVar();
+            final ZeroLengthPath reflexiveSolution = new ZeroLengthPath(subjVar, objVar);
+            node.replaceWith(new InferUnion(originalSP, reflexiveSolution));
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/main/java/org/apache/rya/rdftriplestore/inference/SameAsVisitor.java
----------------------------------------------------------------------
diff --git a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/SameAsVisitor.java b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/SameAsVisitor.java
index 2cdbdee..c616419 100644
--- a/sail/src/main/java/org/apache/rya/rdftriplestore/inference/SameAsVisitor.java
+++ b/sail/src/main/java/org/apache/rya/rdftriplestore/inference/SameAsVisitor.java
@@ -49,7 +49,7 @@ public class SameAsVisitor extends AbstractInferVisitor {
 
     public SameAsVisitor(RdfCloudTripleStoreConfiguration conf, InferenceEngine inferenceEngine) {
         super(conf, inferenceEngine);
-        include = conf.isInferSubPropertyOf(); // oops
+        include = conf.isInferSameAs();
     }
     
     public void meet(StatementPattern sp) throws Exception {

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceEngineTest.java
----------------------------------------------------------------------
diff --git a/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceEngineTest.java b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceEngineTest.java
index e9725e7..b3eb900 100644
--- a/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceEngineTest.java
+++ b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceEngineTest.java
@@ -579,4 +579,45 @@ public class InferenceEngineTest extends TestCase {
         expectedProperties.add(vf.createURI("urn:love"));
         Assert.assertEquals(expectedProperties, inferenceEngine.getHasSelfImplyingType(vf.createURI("urn:Narcissist")));
     }
+
+    @Test
+    public void testPropertyTypes() throws Exception {
+        final String ontology = "INSERT DATA { GRAPH <http://updated/test> {\n"
+                + "  <urn:comment> a owl:AnnotationProperty .\n"
+                + "  <urn:olderThan> a owl:TransitiveProperty, owl:IrreflexiveProperty, owl:AsymmetricProperty .\n"
+                + "  <urn:notYoungerThan> a owl:TransitiveProperty, owl:ReflexiveProperty .\n"
+                + "  <urn:related> a owl:Property, owl:SymmetricProperty, owl:TransitiveProperty .\n"
+                + "  <urn:knows> a owl:SymmetricProperty, owl:ObjectProperty, owl:ReflexiveProperty .\n"
+                + "  <urn:sameAgeAs> a owl:SymmetricProperty, owl:ReflexiveProperty, owl:TransitiveProperty .\n"
+                + "}}";
+        conn.prepareUpdate(QueryLanguage.SPARQL, ontology).execute();
+        inferenceEngine.refreshGraph();
+        final URI comment = vf.createURI("urn:comment"); // none of the three supported types
+        final URI older = vf.createURI("urn:olderThan"); // transitive only
+        final URI notYounger = vf.createURI("urn:notYoungerThan"); // transitive and reflexive
+        final URI related = vf.createURI("urn:related"); // transitive and symmetric
+        final URI knows = vf.createURI("urn:knows"); // reflexive and symmetric
+        final URI sameAge = vf.createURI("urn:sameAgeAs"); // all three
+        // symmetry
+        Assert.assertFalse(inferenceEngine.isSymmetricProperty(comment));
+        Assert.assertFalse(inferenceEngine.isSymmetricProperty(older));
+        Assert.assertFalse(inferenceEngine.isSymmetricProperty(notYounger));
+        Assert.assertTrue(inferenceEngine.isSymmetricProperty(related));
+        Assert.assertTrue(inferenceEngine.isSymmetricProperty(knows));
+        Assert.assertTrue(inferenceEngine.isSymmetricProperty(sameAge));
+        // transitivity
+        Assert.assertFalse(inferenceEngine.isTransitiveProperty(comment));
+        Assert.assertTrue(inferenceEngine.isTransitiveProperty(older));
+        Assert.assertTrue(inferenceEngine.isTransitiveProperty(notYounger));
+        Assert.assertTrue(inferenceEngine.isTransitiveProperty(related));
+        Assert.assertFalse(inferenceEngine.isTransitiveProperty(knows));
+        Assert.assertTrue(inferenceEngine.isTransitiveProperty(sameAge));
+        // reflexivity
+        Assert.assertFalse(inferenceEngine.isReflexiveProperty(comment));
+        Assert.assertFalse(inferenceEngine.isReflexiveProperty(older));
+        Assert.assertTrue(inferenceEngine.isReflexiveProperty(notYounger));
+        Assert.assertFalse(inferenceEngine.isReflexiveProperty(related));
+        Assert.assertTrue(inferenceEngine.isReflexiveProperty(knows));
+        Assert.assertTrue(inferenceEngine.isReflexiveProperty(sameAge));
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceIT.java
----------------------------------------------------------------------
diff --git a/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceIT.java b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceIT.java
index 5a3e35b..375db4a 100644
--- a/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceIT.java
+++ b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/InferenceIT.java
@@ -30,14 +30,17 @@ import org.apache.accumulo.core.client.mock.MockInstance;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.rya.accumulo.AccumuloRdfConfiguration;
 import org.apache.rya.accumulo.AccumuloRyaDAO;
+import org.apache.rya.api.RdfCloudTripleStoreConstants;
 import org.apache.rya.rdftriplestore.RdfCloudTripleStore;
 import org.junit.After;
 import org.junit.Assert;
 import org.junit.Test;
+import org.openrdf.model.URI;
 import org.openrdf.model.Value;
 import org.openrdf.model.ValueFactory;
 import org.openrdf.model.impl.ValueFactoryImpl;
 import org.openrdf.model.vocabulary.FOAF;
+import org.openrdf.model.vocabulary.OWL;
 import org.openrdf.query.BindingSet;
 import org.openrdf.query.QueryLanguage;
 import org.openrdf.query.QueryResultHandlerException;
@@ -606,4 +609,77 @@ public class InferenceIT extends TestCase {
         expected.add(new ListBindingSet(varNames, vf.createURI("urn:Alice")));
         Assert.assertEquals(expected, new HashSet<>(solutions));
     }
+
+    @Test
+    public void testReflexivePropertyQuery() throws Exception {
+        final String ontology = "INSERT DATA { GRAPH <http://updated/test> {\n"
+                + "  <urn:hasFamilyMember> a owl:ReflexiveProperty . \n"
+                + "}}";
+        final String instances = "INSERT DATA { GRAPH <http://updated/test> {\n"
+                + "  <urn:Alice> <urn:hasFamilyMember> <urn:Bob> . \n"
+                + "  <urn:Alice> <urn:knows> <urn:Eve> . \n"
+                + "}}";
+        conn.prepareUpdate(QueryLanguage.SPARQL, ontology).execute();
+        conn.prepareUpdate(QueryLanguage.SPARQL, instances).execute();
+        inferenceEngine.refreshGraph();
+        final URI alice = vf.createURI("urn:Alice");
+        final URI bob = vf.createURI("urn:Bob");
+        final URI carol = vf.createURI("urn:Carol");
+        final URI eve = vf.createURI("urn:Eve");
+        final List<String> varNames = new LinkedList<>();
+        varNames.add("x");
+        final Set<BindingSet> aliceAndBob = new HashSet<>();
+        aliceAndBob.add(new ListBindingSet(varNames, alice));
+        aliceAndBob.add(new ListBindingSet(varNames, bob));
+        final Set<BindingSet> carolOnly = new HashSet<>();
+        carolOnly.add(new ListBindingSet(varNames, carol));
+
+        // Queries where subject constant, object variable:
+        final String aliceFamilyQuery = "SELECT ?x { GRAPH <http://updated/test> { <urn:Alice> <urn:hasFamilyMember> ?x } }";
+        conn.prepareTupleQuery(QueryLanguage.SPARQL, aliceFamilyQuery).evaluate(resultHandler);
+        Assert.assertEquals(aliceAndBob, new HashSet<>(solutions));
+        final String carolFamilyQuery = "SELECT ?x { GRAPH <http://updated/test> { <urn:Carol> <urn:hasFamilyMember> ?x } }";
+        conn.prepareTupleQuery(QueryLanguage.SPARQL, carolFamilyQuery).evaluate(resultHandler);
+        Assert.assertEquals(carolOnly, new HashSet<>(solutions));
+
+        // Queries where subject variable, object constant:
+        final String familyOfBobQuery = "SELECT ?x { GRAPH <http://updated/test> { ?x <urn:hasFamilyMember> <urn:Bob> } }";
+        conn.prepareTupleQuery(QueryLanguage.SPARQL, familyOfBobQuery).evaluate(resultHandler);
+        Assert.assertEquals(aliceAndBob, new HashSet<>(solutions));
+        final String familyOfCarolQuery = "SELECT ?x { GRAPH <http://updated/test> { ?x <urn:hasFamilyMember> <urn:Carol> } }";
+        conn.prepareTupleQuery(QueryLanguage.SPARQL, familyOfCarolQuery).evaluate(resultHandler);
+        Assert.assertEquals(carolOnly, new HashSet<>(solutions));
+
+        varNames.add("y");
+        // Query where both subject and object are variables, but restricted by
+        // other statements
+        final Set<BindingSet> aliceAndBoth = new HashSet<>();
+        aliceAndBoth.add(new ListBindingSet(varNames, alice, bob));
+        aliceAndBoth.add(new ListBindingSet(varNames, alice, alice));
+        final String variableQuery = "SELECT * { GRAPH <http://updated/test> {\n"
+                + "  ?x <urn:knows> <urn:Eve> .\n"
+                + "  ?x <urn:hasFamilyMember> ?y .\n"
+                + "} }";
+        conn.prepareTupleQuery(QueryLanguage.SPARQL, variableQuery).evaluate(resultHandler);
+        Assert.assertEquals(aliceAndBoth, new HashSet<>(solutions));
+
+        // Query where subject and object are unrestricted variables: match
+        // every known node (dangerous, but correct)
+        final URI hasFamily = vf.createURI("urn:hasFamilyMember");
+        final URI rp = vf.createURI(OWL.NAMESPACE, "ReflexiveProperty");
+        final Set<BindingSet> everything = new HashSet<>();
+        everything.add(new ListBindingSet(varNames, alice, alice));
+        everything.add(new ListBindingSet(varNames, bob, bob));
+        everything.add(new ListBindingSet(varNames, alice, bob));
+        everything.add(new ListBindingSet(varNames, eve, eve));
+        everything.add(new ListBindingSet(varNames, hasFamily, hasFamily));
+        everything.add(new ListBindingSet(varNames, rp, rp));
+        everything.add(new ListBindingSet(varNames, RdfCloudTripleStoreConstants.RTS_SUBJECT, RdfCloudTripleStoreConstants.RTS_SUBJECT));
+        everything.add(new ListBindingSet(varNames, RdfCloudTripleStoreConstants.VERSION, RdfCloudTripleStoreConstants.VERSION));
+        final String everythingQuery = "SELECT * { GRAPH <http://updated/test> {\n"
+                + "  ?x <urn:hasFamilyMember> ?y .\n"
+                + "} }";
+        conn.prepareTupleQuery(QueryLanguage.SPARQL, everythingQuery).evaluate(resultHandler);
+        Assert.assertEquals(everything, new HashSet<>(solutions));
+    }
 }

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/test/java/org/apache/rya/rdftriplestore/inference/PropertyChainTest.java
----------------------------------------------------------------------
diff --git a/sail/src/test/java/org/apache/rya/rdftriplestore/inference/PropertyChainTest.java b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/PropertyChainTest.java
new file mode 100644
index 0000000..cf37c43
--- /dev/null
+++ b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/PropertyChainTest.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 java.util.List;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.admin.SecurityOperations;
+import org.apache.accumulo.core.client.mock.MockInstance;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.TablePermission;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.ValueFactoryImpl;
+import org.openrdf.query.QueryLanguage;
+import org.openrdf.query.Update;
+import org.openrdf.repository.sail.SailRepository;
+import org.openrdf.repository.sail.SailRepositoryConnection;
+
+import junit.framework.TestCase;
+import org.apache.rya.accumulo.AccumuloRdfConfiguration;
+import org.apache.rya.accumulo.AccumuloRyaDAO;
+import org.apache.rya.api.RdfCloudTripleStoreConstants;
+import org.apache.rya.rdftriplestore.RdfCloudTripleStore;
+import org.apache.rya.rdftriplestore.inference.InferenceEngine;
+import org.apache.rya.rdftriplestore.inference.InverseURI;
+/*
+ * 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.
+ */
+public class PropertyChainTest extends TestCase {
+    private String user = "user";
+    private String pwd = "pwd";
+    private String instance = "myinstance";
+    private String tablePrefix = "t_";
+    private Authorizations auths = Constants.NO_AUTHS;
+    private Connector connector;
+    private AccumuloRyaDAO ryaDAO;
+    private ValueFactory vf = new ValueFactoryImpl();
+    private String namespace = "urn:test#";
+    private AccumuloRdfConfiguration conf;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        connector = new MockInstance(instance).getConnector(user, pwd.getBytes());
+        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
+        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
+        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
+        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
+        SecurityOperations secOps = connector.securityOperations();
+        secOps.createUser(user, pwd.getBytes(), auths);
+        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, TablePermission.READ);
+        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX, TablePermission.READ);
+        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX, TablePermission.READ);
+        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX, TablePermission.READ);
+
+        conf = new AccumuloRdfConfiguration();
+        ryaDAO = new AccumuloRyaDAO();
+        ryaDAO.setConnector(connector);
+        conf.setTablePrefix(tablePrefix);
+        ryaDAO.setConf(conf);
+        ryaDAO.init();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
+        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
+        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
+        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
+    }
+
+    @Test
+    public void testGraphConfiguration() throws Exception {
+        // build a connection
+        RdfCloudTripleStore store = new RdfCloudTripleStore();
+        store.setConf(conf);
+        store.setRyaDAO(ryaDAO);
+        InferenceEngine inferenceEngine = new InferenceEngine();
+        inferenceEngine.setRyaDAO(ryaDAO);
+        store.setInferenceEngine(inferenceEngine);
+        inferenceEngine.refreshGraph();
+        store.initialize();
+        SailRepository repository = new SailRepository(store);
+        SailRepositoryConnection conn = repository.getConnection();
+        
+
+        
+    	String query = "INSERT DATA\n"//
+    			+ "{ GRAPH <http://updated/test> {\n"//
+    			+ "  <urn:greatMother> owl:propertyChainAxiom <urn:12342>  . " + 
+    			" <urn:12342> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:node1atjakcvbx15023 . " + 
+    			" _:node1atjakcvbx15023 <http://www.w3.org/2002/07/owl#inverseOf> <urn:isChildOf> . " + 
+    			" <urn:12342> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:node1atjakcvbx15123 . " + 
+       			" _:node1atjakcvbx15123 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . " + 
+    			" _:node1atjakcvbx15123 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <urn:MotherOf> .  }}";
+    	Update update = conn.prepareUpdate(QueryLanguage.SPARQL, query);
+    	update.execute();
+        inferenceEngine.refreshGraph();
+       List<URI> chain = inferenceEngine.getPropertyChain(vf.createURI("urn:greatMother"));
+       Assert.assertEquals(chain.size(), 2);
+       Assert.assertEquals(chain.get(0), new InverseURI(vf.createURI("urn:isChildOf")));
+       Assert.assertEquals(chain.get(1), vf.createURI("urn:MotherOf"));
+ 
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/test/java/org/apache/rya/rdftriplestore/inference/ReflexivePropertyVisitorTest.java
----------------------------------------------------------------------
diff --git a/sail/src/test/java/org/apache/rya/rdftriplestore/inference/ReflexivePropertyVisitorTest.java b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/ReflexivePropertyVisitorTest.java
new file mode 100644
index 0000000..f151bd3
--- /dev/null
+++ b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/ReflexivePropertyVisitorTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.
+ */
+package org.apache.rya.rdftriplestore.inference;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+
+import org.apache.rya.accumulo.AccumuloRdfConfiguration;
+import org.apache.rya.api.RdfCloudTripleStoreConfiguration;
+import org.junit.Assert;
+import org.junit.Test;
+import org.openrdf.model.URI;
+import org.openrdf.model.ValueFactory;
+import org.openrdf.model.impl.ValueFactoryImpl;
+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;
+import org.openrdf.query.algebra.ZeroLengthPath;
+
+/**
+ * Tests the methods of {@link ReflexivePropertyVisitor}.
+ */
+public class ReflexivePropertyVisitorTest {
+    private final AccumuloRdfConfiguration conf = new AccumuloRdfConfiguration();
+    private static final ValueFactory VF = new ValueFactoryImpl();
+
+    private static final URI ALICE = VF.createURI("urn:Alice");
+    private static final URI HAS_FAMILY = VF.createURI("urn:hasFamilyMember");
+
+    @Test
+    public void testReflexiveProperty() throws Exception {
+        // Define a reflexive property
+        final InferenceEngine inferenceEngine = mock(InferenceEngine.class);
+        when(inferenceEngine.isReflexiveProperty(HAS_FAMILY)).thenReturn(true);
+        // Construct a query, then visit it
+        final StatementPattern sp = new StatementPattern(new Var("s", ALICE), new Var("p", HAS_FAMILY), new Var("o"));
+        final Projection query = new Projection(sp, new ProjectionElemList(new ProjectionElem("o", "member")));
+        query.visit(new ReflexivePropertyVisitor(conf, inferenceEngine));
+        // Expected structure after rewriting SP(:Alice :hasFamilyMember ?member):
+        //
+        // Union(
+        //     originalSP(:Alice :hasFamilyMember ?member),
+        //     ZeroLengthPath(:Alice, ?member)
+        // )
+        Assert.assertTrue(query.getArg() instanceof Union);
+        final TupleExpr left = ((Union) query.getArg()).getLeftArg();
+        final TupleExpr right = ((Union) query.getArg()).getRightArg();
+        Assert.assertEquals(sp, left);
+        Assert.assertTrue(right instanceof ZeroLengthPath);
+        Assert.assertEquals(sp.getSubjectVar(), ((ZeroLengthPath) right).getSubjectVar());
+        Assert.assertEquals(sp.getObjectVar(), ((ZeroLengthPath) right).getObjectVar());
+    }
+
+    @Test
+    public void testReflexivePropertyDisabled() throws Exception {
+        // Disable inference
+        final RdfCloudTripleStoreConfiguration disabledConf = conf.clone();
+        disabledConf.setInferReflexiveProperty(false);
+        // Define a reflexive property
+        final InferenceEngine inferenceEngine = mock(InferenceEngine.class);
+        when(inferenceEngine.isReflexiveProperty(HAS_FAMILY)).thenReturn(true);
+        // Construct a query, then make a copy and visit the copy
+        final Projection query = new Projection(
+                new StatementPattern(new Var("s", ALICE), new Var("p", HAS_FAMILY), new Var("o")),
+                new ProjectionElemList(new ProjectionElem("s", "subject")));
+        final Projection modifiedQuery = query.clone();
+        modifiedQuery.visit(new ReflexivePropertyVisitor(disabledConf, inferenceEngine));
+        // There should be no difference
+        Assert.assertEquals(query, modifiedQuery);
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/test/java/org/apache/rya/rdftriplestore/inference/SameAsTest.java
----------------------------------------------------------------------
diff --git a/sail/src/test/java/org/apache/rya/rdftriplestore/inference/SameAsTest.java b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/SameAsTest.java
new file mode 100644
index 0000000..43184c4
--- /dev/null
+++ b/sail/src/test/java/org/apache/rya/rdftriplestore/inference/SameAsTest.java
@@ -0,0 +1,115 @@
+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 info.aduna.iteration.Iterations;
+import junit.framework.TestCase;
+import org.apache.rya.accumulo.AccumuloRdfConfiguration;
+import org.apache.rya.accumulo.AccumuloRyaDAO;
+import org.apache.rya.api.RdfCloudTripleStoreConstants;
+import org.apache.rya.api.resolver.RdfToRyaConversions;
+import org.apache.rya.rdftriplestore.RdfCloudTripleStore;
+import org.apache.rya.rdftriplestore.inference.InferenceEngine;
+
+import org.apache.accumulo.core.Constants;
+import org.apache.accumulo.core.client.Connector;
+import org.apache.accumulo.core.client.admin.SecurityOperations;
+import org.apache.accumulo.core.client.mock.MockInstance;
+import org.apache.accumulo.core.security.Authorizations;
+import org.apache.accumulo.core.security.TablePermission;
+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.StatementImpl;
+import org.openrdf.model.impl.ValueFactoryImpl;
+
+public class SameAsTest extends TestCase {
+    private String user = "user";
+    private String pwd = "pwd";
+    private String instance = "myinstance";
+    private String tablePrefix = "t_";
+    private Authorizations auths = Constants.NO_AUTHS;
+    private Connector connector;
+    private AccumuloRyaDAO ryaDAO;
+    private ValueFactory vf = new ValueFactoryImpl();
+    private String namespace = "urn:test#";
+    private AccumuloRdfConfiguration conf;
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        connector = new MockInstance(instance).getConnector(user, pwd.getBytes());
+        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
+        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
+        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
+        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
+        SecurityOperations secOps = connector.securityOperations();
+        secOps.createUser(user, pwd.getBytes(), auths);
+        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, TablePermission.READ);
+        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX, TablePermission.READ);
+        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX, TablePermission.READ);
+        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX, TablePermission.READ);
+
+        conf = new AccumuloRdfConfiguration();
+        ryaDAO = new AccumuloRyaDAO();
+        ryaDAO.setConnector(connector);
+        conf.setTablePrefix(tablePrefix);
+        ryaDAO.setConf(conf);
+        ryaDAO.init();
+    }
+
+    @Override
+    public void tearDown() throws Exception {
+        super.tearDown();
+        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
+        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
+        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
+        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
+    }
+
+    @Test
+    //This isn't a good test.  It's simply a cut-and-paste from a test that was failing in a different package in the SameAsVisitor.
+    public void testGraphConfiguration() throws Exception {
+        URI a = vf.createURI(namespace, "a");
+        Statement statement = new StatementImpl(a, vf.createURI(namespace, "p"), vf.createLiteral("l"));
+        Statement statement2 = new StatementImpl(a, vf.createURI(namespace, "p2"), vf.createLiteral("l"));
+        ryaDAO.add(RdfToRyaConversions.convertStatement(statement));
+        ryaDAO.add(RdfToRyaConversions.convertStatement(statement2));
+        ryaDAO.add(RdfToRyaConversions.convertStatement(new StatementImpl(vf.createURI(namespace, "b"), vf.createURI(namespace, "p"), vf.createLiteral("l"))));
+        ryaDAO.add(RdfToRyaConversions.convertStatement(new StatementImpl(vf.createURI(namespace, "c"), vf.createURI(namespace, "n"), vf.createLiteral("l"))));
+
+        // build a connection
+        RdfCloudTripleStore store = new RdfCloudTripleStore();
+        store.setConf(conf);
+        store.setRyaDAO(ryaDAO);
+
+        InferenceEngine inferenceEngine = new InferenceEngine();
+        inferenceEngine.setRyaDAO(ryaDAO);
+        store.setInferenceEngine(inferenceEngine);
+        
+        store.initialize();
+
+        System.out.println(Iterations.asList(store.getConnection().getStatements(a, vf.createURI(namespace, "p"), vf.createLiteral("l"), false, new Resource[0])).size());
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/test/java/org/apache/rya/triplestore/inference/PropertyChainTest.java
----------------------------------------------------------------------
diff --git a/sail/src/test/java/org/apache/rya/triplestore/inference/PropertyChainTest.java b/sail/src/test/java/org/apache/rya/triplestore/inference/PropertyChainTest.java
deleted file mode 100644
index 3a53b3d..0000000
--- a/sail/src/test/java/org/apache/rya/triplestore/inference/PropertyChainTest.java
+++ /dev/null
@@ -1,140 +0,0 @@
-package org.apache.rya.triplestore.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 java.util.List;
-
-import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.admin.SecurityOperations;
-import org.apache.accumulo.core.client.mock.MockInstance;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.TablePermission;
-import org.junit.Assert;
-import org.junit.Test;
-import org.openrdf.model.URI;
-import org.openrdf.model.ValueFactory;
-import org.openrdf.model.impl.ValueFactoryImpl;
-import org.openrdf.query.QueryLanguage;
-import org.openrdf.query.Update;
-import org.openrdf.repository.sail.SailRepository;
-import org.openrdf.repository.sail.SailRepositoryConnection;
-
-import junit.framework.TestCase;
-import org.apache.rya.accumulo.AccumuloRdfConfiguration;
-import org.apache.rya.accumulo.AccumuloRyaDAO;
-import org.apache.rya.api.RdfCloudTripleStoreConstants;
-import org.apache.rya.rdftriplestore.RdfCloudTripleStore;
-import org.apache.rya.rdftriplestore.inference.InferenceEngine;
-import org.apache.rya.rdftriplestore.inference.InverseURI;
-/*
- * 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.
- */
-public class PropertyChainTest extends TestCase {
-    private String user = "user";
-    private String pwd = "pwd";
-    private String instance = "myinstance";
-    private String tablePrefix = "t_";
-    private Authorizations auths = Constants.NO_AUTHS;
-    private Connector connector;
-    private AccumuloRyaDAO ryaDAO;
-    private ValueFactory vf = new ValueFactoryImpl();
-    private String namespace = "urn:test#";
-    private AccumuloRdfConfiguration conf;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        connector = new MockInstance(instance).getConnector(user, pwd.getBytes());
-        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
-        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
-        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
-        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
-        SecurityOperations secOps = connector.securityOperations();
-        secOps.createUser(user, pwd.getBytes(), auths);
-        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, TablePermission.READ);
-        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX, TablePermission.READ);
-        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX, TablePermission.READ);
-        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX, TablePermission.READ);
-
-        conf = new AccumuloRdfConfiguration();
-        ryaDAO = new AccumuloRyaDAO();
-        ryaDAO.setConnector(connector);
-        conf.setTablePrefix(tablePrefix);
-        ryaDAO.setConf(conf);
-        ryaDAO.init();
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
-        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
-        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
-        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
-    }
-
-    @Test
-    public void testGraphConfiguration() throws Exception {
-        // build a connection
-        RdfCloudTripleStore store = new RdfCloudTripleStore();
-        store.setConf(conf);
-        store.setRyaDAO(ryaDAO);
-        InferenceEngine inferenceEngine = new InferenceEngine();
-        inferenceEngine.setRyaDAO(ryaDAO);
-        store.setInferenceEngine(inferenceEngine);
-        inferenceEngine.refreshGraph();
-        store.initialize();
-        SailRepository repository = new SailRepository(store);
-        SailRepositoryConnection conn = repository.getConnection();
-        
-
-        
-    	String query = "INSERT DATA\n"//
-    			+ "{ GRAPH <http://updated/test> {\n"//
-    			+ "  <urn:greatMother> owl:propertyChainAxiom <urn:12342>  . " + 
-    			" <urn:12342> <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> _:node1atjakcvbx15023 . " + 
-    			" _:node1atjakcvbx15023 <http://www.w3.org/2002/07/owl#inverseOf> <urn:isChildOf> . " + 
-    			" <urn:12342> <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> _:node1atjakcvbx15123 . " + 
-       			" _:node1atjakcvbx15123 <http://www.w3.org/1999/02/22-rdf-syntax-ns#rest> <http://www.w3.org/1999/02/22-rdf-syntax-ns#nil> . " + 
-    			" _:node1atjakcvbx15123 <http://www.w3.org/1999/02/22-rdf-syntax-ns#first> <urn:MotherOf> .  }}";
-    	Update update = conn.prepareUpdate(QueryLanguage.SPARQL, query);
-    	update.execute();
-        inferenceEngine.refreshGraph();
-       List<URI> chain = inferenceEngine.getPropertyChain(vf.createURI("urn:greatMother"));
-       Assert.assertEquals(chain.size(), 2);
-       Assert.assertEquals(chain.get(0), new InverseURI(vf.createURI("urn:isChildOf")));
-       Assert.assertEquals(chain.get(1), vf.createURI("urn:MotherOf"));
- 
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-rya/blob/ad6ab018/sail/src/test/java/org/apache/rya/triplestore/inference/SameAsTest.java
----------------------------------------------------------------------
diff --git a/sail/src/test/java/org/apache/rya/triplestore/inference/SameAsTest.java b/sail/src/test/java/org/apache/rya/triplestore/inference/SameAsTest.java
deleted file mode 100644
index a861392..0000000
--- a/sail/src/test/java/org/apache/rya/triplestore/inference/SameAsTest.java
+++ /dev/null
@@ -1,115 +0,0 @@
-package org.apache.rya.triplestore.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 info.aduna.iteration.Iterations;
-import junit.framework.TestCase;
-import org.apache.rya.accumulo.AccumuloRdfConfiguration;
-import org.apache.rya.accumulo.AccumuloRyaDAO;
-import org.apache.rya.api.RdfCloudTripleStoreConstants;
-import org.apache.rya.api.resolver.RdfToRyaConversions;
-import org.apache.rya.rdftriplestore.RdfCloudTripleStore;
-import org.apache.rya.rdftriplestore.inference.InferenceEngine;
-
-import org.apache.accumulo.core.Constants;
-import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.admin.SecurityOperations;
-import org.apache.accumulo.core.client.mock.MockInstance;
-import org.apache.accumulo.core.security.Authorizations;
-import org.apache.accumulo.core.security.TablePermission;
-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.StatementImpl;
-import org.openrdf.model.impl.ValueFactoryImpl;
-
-public class SameAsTest extends TestCase {
-    private String user = "user";
-    private String pwd = "pwd";
-    private String instance = "myinstance";
-    private String tablePrefix = "t_";
-    private Authorizations auths = Constants.NO_AUTHS;
-    private Connector connector;
-    private AccumuloRyaDAO ryaDAO;
-    private ValueFactory vf = new ValueFactoryImpl();
-    private String namespace = "urn:test#";
-    private AccumuloRdfConfiguration conf;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        connector = new MockInstance(instance).getConnector(user, pwd.getBytes());
-        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
-        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
-        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
-        connector.tableOperations().create(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
-        SecurityOperations secOps = connector.securityOperations();
-        secOps.createUser(user, pwd.getBytes(), auths);
-        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX, TablePermission.READ);
-        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX, TablePermission.READ);
-        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX, TablePermission.READ);
-        secOps.grantTablePermission(user, tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX, TablePermission.READ);
-
-        conf = new AccumuloRdfConfiguration();
-        ryaDAO = new AccumuloRyaDAO();
-        ryaDAO.setConnector(connector);
-        conf.setTablePrefix(tablePrefix);
-        ryaDAO.setConf(conf);
-        ryaDAO.init();
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_SPO_SUFFIX);
-        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_PO_SUFFIX);
-        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_OSP_SUFFIX);
-        connector.tableOperations().delete(tablePrefix + RdfCloudTripleStoreConstants.TBL_NS_SUFFIX);
-    }
-
-    @Test
-    //This isn't a good test.  It's simply a cut-and-paste from a test that was failing in a different package in the SameAsVisitor.
-    public void testGraphConfiguration() throws Exception {
-        URI a = vf.createURI(namespace, "a");
-        Statement statement = new StatementImpl(a, vf.createURI(namespace, "p"), vf.createLiteral("l"));
-        Statement statement2 = new StatementImpl(a, vf.createURI(namespace, "p2"), vf.createLiteral("l"));
-        ryaDAO.add(RdfToRyaConversions.convertStatement(statement));
-        ryaDAO.add(RdfToRyaConversions.convertStatement(statement2));
-        ryaDAO.add(RdfToRyaConversions.convertStatement(new StatementImpl(vf.createURI(namespace, "b"), vf.createURI(namespace, "p"), vf.createLiteral("l"))));
-        ryaDAO.add(RdfToRyaConversions.convertStatement(new StatementImpl(vf.createURI(namespace, "c"), vf.createURI(namespace, "n"), vf.createLiteral("l"))));
-
-        // build a connection
-        RdfCloudTripleStore store = new RdfCloudTripleStore();
-        store.setConf(conf);
-        store.setRyaDAO(ryaDAO);
-
-        InferenceEngine inferenceEngine = new InferenceEngine();
-        inferenceEngine.setRyaDAO(ryaDAO);
-        store.setInferenceEngine(inferenceEngine);
-        
-        store.initialize();
-
-        System.out.println(Iterations.asList(store.getConnection().getStatements(a, vf.createURI(namespace, "p"), vf.createLiteral("l"), false, new Resource[0])).size());
-    }
-}