[jira] [Commented] (RYA-297) Implement owl:equivalentClass inference
[ https://issues.apache.org/jira/browse/RYA-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129593#comment-16129593 ] ASF GitHub Bot commented on RYA-297: Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/184 > Implement owl:equivalentClass inference > --- > > Key: RYA-297 > URL: https://issues.apache.org/jira/browse/RYA-297 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Jesse Hatfield > > An *{{owl:equivalentClass}}* statement is equivalent to stating that two > classes are each subclasses of the other. > The inference engine already supports subclass reasoning, but appears not to > check for equivalent class statements. This can likely be handled by adding > the relationship to the subclass graph in both directions, as seems to be > done for equivalent properties. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #184: RYA-297 Added owl:equivalentClass inference
Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/184 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-340) rya.fluo.pcj.app is not currently deployable in fluo-1.0.0
[ https://issues.apache.org/jira/browse/RYA-340?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129561#comment-16129561 ] ASF GitHub Bot commented on RYA-340: Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/207 > rya.fluo.pcj.app is not currently deployable in fluo-1.0.0 > -- > > Key: RYA-340 > URL: https://issues.apache.org/jira/browse/RYA-340 > Project: Rya > Issue Type: Sub-task > Components: build >Reporter: Jeff Dasch >Assignee: Jeff Dasch > > There is a guava versioning incompatibility. Fastest fix is to improve the > generated artifact through filtering. > {noformat} > Exception in thread "ServiceDelegate STARTING" > java.lang.IncompatibleClassChangeError: class > org.apache.twill.internal.utils.Dependencies$DependencyClassVisitor has > interface org.objectweb.asm.ClassVisitor as super class > at java.lang.ClassLoader.defineClass1(Native Method) > at java.lang.ClassLoader.defineClass(ClassLoader.java:763) > at > java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142) > at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) > at java.net.URLClassLoader.access$100(URLClassLoader.java:73) > at java.net.URLClassLoader$1.run(URLClassLoader.java:368) > at java.net.URLClassLoader$1.run(URLClassLoader.java:362) > at java.security.AccessController.doPrivileged(Native Method) > at java.net.URLClassLoader.findClass(URLClassLoader.java:361) > at java.lang.ClassLoader.loadClass(ClassLoader.java:424) > at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) > at java.lang.ClassLoader.loadClass(ClassLoader.java:357) > at > org.apache.twill.internal.utils.Dependencies.findClassDependencies(Dependencies.java:86) > at > org.apache.twill.internal.ApplicationBundler.findDependencies(ApplicationBundler.java:198) > at > org.apache.twill.internal.ApplicationBundler.createBundle(ApplicationBundler.java:155) > at > org.apache.twill.internal.ApplicationBundler.createBundle(ApplicationBundler.java:126) > at > org.apache.twill.yarn.YarnTwillPreparer.createAppMasterJar(YarnTwillPreparer.java:402) > at > org.apache.twill.yarn.YarnTwillPreparer.access$200(YarnTwillPreparer.java:108) > at > org.apache.twill.yarn.YarnTwillPreparer$1.call(YarnTwillPreparer.java:299) > at > org.apache.twill.yarn.YarnTwillPreparer$1.call(YarnTwillPreparer.java:289) > at > org.apache.twill.yarn.YarnTwillController.doStartUp(YarnTwillController.java:97) > at > org.apache.twill.internal.AbstractZKServiceController.startUp(AbstractZKServiceController.java:76) > at > org.apache.twill.internal.AbstractExecutionServiceController$ServiceDelegate.startUp(AbstractExecutionServiceController.java:175) > at > com.google.common.util.concurrent.AbstractIdleService$1$1.run(AbstractIdleService.java:43) > at java.lang.Thread.run(Thread.java:748) > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #207: RYA-340 Added dependency filtering to rya.p...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/207 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129548#comment-16129548 ] ASF GitHub Bot commented on RYA-292: Github user asfgit commented on the issue: https://github.com/apache/incubator-rya/pull/206 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/402/ > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya issue #206: RYA-292 Added owl:intersectionOf inference.
Github user asfgit commented on the issue: https://github.com/apache/incubator-rya/pull/206 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/402/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129420#comment-16129420 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133567576 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . --- End diff -- You're welcome > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133567576 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . --- End diff -- You're welcome --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129416#comment-16129416 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133567115 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); -
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133567115 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - propURI = iter2Statement.getObject(); -
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129412#comment-16129412 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566726 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/ReorderJoinVisitor.java --- @@ -31,24 +31,24 @@ * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class ReorderJoinVisitor extends QueryModelVisitorBase { +public class ReorderJoinVisitor extends QueryModelVisitorBase { --- End diff -- Removed a warning. The rest was save actions. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566726 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/ReorderJoinVisitor.java --- @@ -31,24 +31,24 @@ * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class ReorderJoinVisitor extends QueryModelVisitorBase { +public class ReorderJoinVisitor extends QueryModelVisitorBase { --- End diff -- Removed a warning. The rest was save actions. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129410#comment-16129410 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566575 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/FilterRangeVisitor.java --- @@ -27,63 +33,62 @@ import org.openrdf.model.Value; import org.openrdf.model.impl.BooleanLiteralImpl; import org.openrdf.query.QueryEvaluationException; -import org.openrdf.query.algebra.*; +import org.openrdf.query.algebra.Filter; +import org.openrdf.query.algebra.FunctionCall; +import org.openrdf.query.algebra.StatementPattern; +import org.openrdf.query.algebra.ValueConstant; +import org.openrdf.query.algebra.ValueExpr; +import org.openrdf.query.algebra.Var; import org.openrdf.query.algebra.helpers.QueryModelVisitorBase; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.apache.rya.api.RdfCloudTripleStoreConstants.RANGE; - /** * Class FilterTimeIndexVisitor * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class FilterRangeVisitor extends QueryModelVisitorBase { +public class FilterRangeVisitor extends QueryModelVisitorBase { -private RdfCloudTripleStoreConfiguration conf; -private Map rangeValues = new HashMap(); +private final RdfCloudTripleStoreConfiguration conf; +private final Map rangeValues = new HashMap(); -public FilterRangeVisitor(RdfCloudTripleStoreConfiguration conf) { +public FilterRangeVisitor(final RdfCloudTripleStoreConfiguration conf) { this.conf = conf; } @Override -public void meet(Filter node) throws Exception { +public void meet(final Filter node) throws Exception { --- End diff -- Removed a warning. The rest was save actions. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129411#comment-16129411 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566617 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/PushJoinDownVisitor.java --- @@ -30,26 +30,26 @@ * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class PushJoinDownVisitor extends QueryModelVisitorBase { +public class PushJoinDownVisitor extends QueryModelVisitorBase { @Override -public void meet(Join node) throws Exception { +public void meet(final Join node) throws Exception { --- End diff -- Removed a warning. The rest was save actions. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566575 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/FilterRangeVisitor.java --- @@ -27,63 +33,62 @@ import org.openrdf.model.Value; import org.openrdf.model.impl.BooleanLiteralImpl; import org.openrdf.query.QueryEvaluationException; -import org.openrdf.query.algebra.*; +import org.openrdf.query.algebra.Filter; +import org.openrdf.query.algebra.FunctionCall; +import org.openrdf.query.algebra.StatementPattern; +import org.openrdf.query.algebra.ValueConstant; +import org.openrdf.query.algebra.ValueExpr; +import org.openrdf.query.algebra.Var; import org.openrdf.query.algebra.helpers.QueryModelVisitorBase; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.apache.rya.api.RdfCloudTripleStoreConstants.RANGE; - /** * Class FilterTimeIndexVisitor * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class FilterRangeVisitor extends QueryModelVisitorBase { +public class FilterRangeVisitor extends QueryModelVisitorBase { -private RdfCloudTripleStoreConfiguration conf; -private Map rangeValues = new HashMap(); +private final RdfCloudTripleStoreConfiguration conf; +private final Map rangeValues = new HashMap(); -public FilterRangeVisitor(RdfCloudTripleStoreConfiguration conf) { +public FilterRangeVisitor(final RdfCloudTripleStoreConfiguration conf) { this.conf = conf; } @Override -public void meet(Filter node) throws Exception { +public void meet(final Filter node) throws Exception { --- End diff -- Removed a warning. The rest was save actions. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566617 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/PushJoinDownVisitor.java --- @@ -30,26 +30,26 @@ * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class PushJoinDownVisitor extends QueryModelVisitorBase { +public class PushJoinDownVisitor extends QueryModelVisitorBase { @Override -public void meet(Join node) throws Exception { +public void meet(final Join node) throws Exception { --- End diff -- Removed a warning. The rest was save actions. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129407#comment-16129407 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566400 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { +checkNotNull(ryaDaoStatementIterHandler); +final CloseableIteration iter = RyaDAOHelper.query(ryaDao, subject, predicate, object, conf, contexts); +try { +while (iter.hasNext()) { +final Statement statement = iter.next(); +try { + ryaDaoStatementIterHandler.handleStatementIter(statement); +} catch (final Exception e) { +throw new QueryEvaluationException("Error handling statement.", e); +} +} +} finally { +if (iter != null) { +iter.close(); +} +} +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @par
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129409#comment-16129409 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566456 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoStatementIterHandler.java --- @@ -0,0 +1,35 @@ +/* + * 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.api.persist.utils; + +import org.apache.rya.api.persist.RyaDAO; +import org.openrdf.model.Statement; + +/** + * Handles the statements returned from a {@link RyaDAO} query iterator. + */ +public abstract class RyaDaoStatementIterHandler { --- End diff -- Done > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129408#comment-16129408 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566433 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { +checkNotNull(ryaDaoStatementIterHandler); +final CloseableIteration iter = RyaDAOHelper.query(ryaDao, subject, predicate, object, conf, contexts); +try { +while (iter.hasNext()) { +final Statement statement = iter.next(); +try { + ryaDaoStatementIterHandler.handleStatementIter(statement); +} catch (final Exception e) { +throw new QueryEvaluationException("Error handling statement.", e); +} +} +} finally { +if (iter != null) { +iter.close(); +} +} +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @par
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566433 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { +checkNotNull(ryaDaoStatementIterHandler); +final CloseableIteration iter = RyaDAOHelper.query(ryaDao, subject, predicate, object, conf, contexts); +try { +while (iter.hasNext()) { +final Statement statement = iter.next(); +try { + ryaDaoStatementIterHandler.handleStatementIter(statement); +} catch (final Exception e) { +throw new QueryEvaluationException("Error handling statement.", e); +} +} +} finally { +if (iter != null) { +iter.close(); +} +} +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param statement the {@link Statement} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @throws QueryEvaluationE
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566456 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoStatementIterHandler.java --- @@ -0,0 +1,35 @@ +/* + * 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.api.persist.utils; + +import org.apache.rya.api.persist.RyaDAO; +import org.openrdf.model.Statement; + +/** + * Handles the statements returned from a {@link RyaDAO} query iterator. + */ +public abstract class RyaDaoStatementIterHandler { --- End diff -- Done --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566400 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { +checkNotNull(ryaDaoStatementIterHandler); +final CloseableIteration iter = RyaDAOHelper.query(ryaDao, subject, predicate, object, conf, contexts); +try { +while (iter.hasNext()) { +final Statement statement = iter.next(); +try { + ryaDaoStatementIterHandler.handleStatementIter(statement); +} catch (final Exception e) { +throw new QueryEvaluationException("Error handling statement.", e); +} +} +} finally { +if (iter != null) { +iter.close(); +} +} +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param statement the {@link Statement} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @throws QueryEvaluationE
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129404#comment-16129404 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566012 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { --- End diff -- Changed to RDFHandler in this class and RDFHandlerBase in the InferenceEngine. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have b
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133566012 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { --- End diff -- Changed to RDFHandler in this class and RDFHandlerBase in the InferenceEngine. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565628 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -467,126 +585,180 @@ private static void addParents(Vertex v, Set parents) { }); } -public boolean isSymmetricProperty(URI prop) { +public boolean isSymmetricProperty(final URI prop) { return (symmetricPropertySet != null) && symmetricPropertySet.contains(prop); } -public URI findInverseOf(URI prop) { +public URI findInverseOf(final URI prop) { return (inverseOfMap != null) ? inverseOfMap.get(prop) : (null); } -public boolean isTransitiveProperty(URI prop) { +public boolean isTransitiveProperty(final URI prop) { return (transitivePropertySet != null) && transitivePropertySet.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 findTransitiveProperty(Resource subj, URI prop, Value obj, Resource... contxts) throws InferenceEngineException { +public Set findTransitiveProperty(final Resource subj, final URI prop, final Value obj, final Resource... contxts) throws InferenceEngineException { if (transitivePropertySet.contains(prop)) { -Set sts = new HashSet(); -boolean goUp = subj == null; +final Set sts = new HashSet<>(); +final boolean goUp = subj == null; chainTransitiveProperty(subj, prop, obj, (goUp) ? (obj) : (subj), sts, goUp, contxts); return sts; -} else +} else { return null; +} } /** * 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 findSameAs(Resource value, Resource... contxts) throws InferenceEngineException{ - Set sameAs = new HashSet(); - sameAs.add(value); - findSameAsChaining(value, sameAs, contxts); - return sameAs; +public Set findSameAs(final Resource value, final Resource... contxts) throws InferenceEngineException{ +final Set sameAs = new HashSet(); +sameAs.add(value); +findSameAsChaining(value, sameAs, contxts); +return sameAs; +} + +public CloseableIteration queryDao(final Resource subject, final URI predicate, final Value object, final Resource... contexts) throws QueryEvaluationException { +return RyaDAOHelper.query(ryaDAO, subject, predicate, object, conf, contexts); } /** * 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 void findSameAsChaining(Resource subj, Set currentSameAs, Resource[] contxts) throws InferenceEngineException{ +public void findSameAsChaining(final Resource subj, final Set currentSameAs, final Resource[] contxts) throws InferenceEngineException{ +CloseableIteration subjIter = null; +CloseableIteration objIter = null; try { - CloseableIteration subjIter = RyaDAOHelper.query(ryaDAO, subj, OWL.SAMEAS, null, conf, contxts); - while (subjIter.hasNext()){ - Statement st = subjIter.next(); - if (!currentSameAs.contains(st.getObject())){ - Resource castedObj = (Resource) st.getObject(); - currentSameAs.add(castedObj); - findSameAsChaining(castedObj, currentSameAs, contxts); - } - } - subjIter.close(); - CloseableIteration objIter = RyaDAOHelper.query(ryaDAO, null, OWL.SAMEAS, subj, conf, contxts); - while (objIter.hasNext()){ - Statement st = objIter.next(); - if (!currentSameAs.contains(st.getSubject())){ - Resource sameAsSubj = st.getSubject(); - currentSameAs.add(sameAsSubj); - findSameAsChaining(sameAsSubj, currentSameAs, contxts); - } - } - objIte
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129399#comment-16129399 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565628 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -467,126 +585,180 @@ private static void addParents(Vertex v, Set parents) { }); } -public boolean isSymmetricProperty(URI prop) { +public boolean isSymmetricProperty(final URI prop) { return (symmetricPropertySet != null) && symmetricPropertySet.contains(prop); } -public URI findInverseOf(URI prop) { +public URI findInverseOf(final URI prop) { return (inverseOfMap != null) ? inverseOfMap.get(prop) : (null); } -public boolean isTransitiveProperty(URI prop) { +public boolean isTransitiveProperty(final URI prop) { return (transitivePropertySet != null) && transitivePropertySet.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 findTransitiveProperty(Resource subj, URI prop, Value obj, Resource... contxts) throws InferenceEngineException { +public Set findTransitiveProperty(final Resource subj, final URI prop, final Value obj, final Resource... contxts) throws InferenceEngineException { if (transitivePropertySet.contains(prop)) { -Set sts = new HashSet(); -boolean goUp = subj == null; +final Set sts = new HashSet<>(); +final boolean goUp = subj == null; chainTransitiveProperty(subj, prop, obj, (goUp) ? (obj) : (subj), sts, goUp, contxts); return sts; -} else +} else { return null; +} } /** * 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 findSameAs(Resource value, Resource... contxts) throws InferenceEngineException{ - Set sameAs = new HashSet(); - sameAs.add(value); - findSameAsChaining(value, sameAs, contxts); - return sameAs; +public Set findSameAs(final Resource value, final Resource... contxts) throws InferenceEngineException{ +final Set sameAs = new HashSet(); +sameAs.add(value); +findSameAsChaining(value, sameAs, contxts); +return sameAs; +} + +public CloseableIteration queryDao(final Resource subject, final URI predicate, final Value object, final Resource... contexts) throws QueryEvaluationException { +return RyaDAOHelper.query(ryaDAO, subject, predicate, object, conf, contexts); } /** * 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 void findSameAsChaining(Resource subj, Set currentSameAs, Resource[] contxts) throws InferenceEngineException{ +public void findSameAsChaining(final Resource subj, final Set currentSameAs, final Resource[] contxts) throws InferenceEngineException{ +CloseableIteration subjIter = null; +CloseableIteration objIter = null; try { - CloseableIteration subjIter = RyaDAOHelper.query(ryaDAO, subj, OWL.SAMEAS, null, conf, contxts); - while (subjIter.hasNext()){ - Statement st = subjIter.next(); - if (!currentSameAs.contains(st.getObject())){ - Resource castedObj = (Resource) st.getObject(); - currentSameAs.add(castedObj); - findSameAsChaining(castedObj, currentSameAs, contxts); - } - } - subjIter.close(); - CloseableIteration objIter = RyaDAOHelper.query(ryaDAO, null, OWL.SAMEAS, subj, conf, contxts); - while (objIter.hasNext()){ - Statement st = objIter.next(); - if (!currentSameAs.contains(st.getSubject())){ - Resource sameAsSubj = st.getSubject(); -
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129395#comment-16129395 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565444 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . +ryaDaoQueryWrapper.queryAll(null, OWL.INTERSECTIONOF, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st1) throws Exception { +final Resource type = st1.getSubject(); +// head will point to a type that is part of the intersection. +URI head = (URI) st1.getObject(); +if (!intersectionsProp.containsKey(type)) { +intersectionsProp.put(type, new ArrayList>()); +} +final Set intersection = new HashSet<>(); +// Go through and find all bnodes that are part of the defined +// intersection. +while (!RDF.NIL.equals(head)) { +// rdf.first will point to a type item that is in the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.FIRST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st2) throws Exception{ +// The object found in the query represents a type +// that should be included in the intersection. +final URI obj2 = (URI) st2.getObject(); +intersection.add(obj2); +} +}); +final List headHolder = new ArrayList<>(1); +// rdf.rest will point to the next bnode that's part of the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.REST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st3) throws Exception { +// This object is the next bnode head to look for. +final URI obj3 = (URI) st3.getObject(); +headHolder.add(obj3); +} +}); +// As long as we get a new head there are more bnodes that +// are part of the intersection. Keep going until we reach +// rdf.nil. +if (!headHolder.isEmpty()) { +head = headHolder.get(0); +} else { +head = RDF.NIL; +} +} +// Add this intersection for this type. There may be more +// intersections for this type so each type has a list of +// intersection sets. +intersectionsProp.get(type).add(intersection); +} +}); + +for (final Map.Entry>> entry : intersectionsProp.entrySet()) { +final Resource type = entry.getKey(); +final List> intersectionList = entry.getValue(); +final Set otherTypes = new HashSet<>(); +// Combine all of a type's intersections together. +for (final Set intersection : intersectionList) { +otherTypes.addAll(intersection); +} +for (final Resource other : otherTypes) { +// :A intersectionOf[:B, :C] implies that +
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129394#comment-16129394 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565270 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); -
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565444 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . +ryaDaoQueryWrapper.queryAll(null, OWL.INTERSECTIONOF, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st1) throws Exception { +final Resource type = st1.getSubject(); +// head will point to a type that is part of the intersection. +URI head = (URI) st1.getObject(); +if (!intersectionsProp.containsKey(type)) { +intersectionsProp.put(type, new ArrayList>()); +} +final Set intersection = new HashSet<>(); +// Go through and find all bnodes that are part of the defined +// intersection. +while (!RDF.NIL.equals(head)) { +// rdf.first will point to a type item that is in the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.FIRST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st2) throws Exception{ +// The object found in the query represents a type +// that should be included in the intersection. +final URI obj2 = (URI) st2.getObject(); +intersection.add(obj2); +} +}); +final List headHolder = new ArrayList<>(1); +// rdf.rest will point to the next bnode that's part of the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.REST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st3) throws Exception { +// This object is the next bnode head to look for. +final URI obj3 = (URI) st3.getObject(); +headHolder.add(obj3); +} +}); +// As long as we get a new head there are more bnodes that +// are part of the intersection. Keep going until we reach +// rdf.nil. +if (!headHolder.isEmpty()) { +head = headHolder.get(0); +} else { +head = RDF.NIL; +} +} +// Add this intersection for this type. There may be more +// intersections for this type so each type has a list of +// intersection sets. +intersectionsProp.get(type).add(intersection); +} +}); + +for (final Map.Entry>> entry : intersectionsProp.entrySet()) { +final Resource type = entry.getKey(); +final List> intersectionList = entry.getValue(); +final Set otherTypes = new HashSet<>(); +// Combine all of a type's intersections together. +for (final Set intersection : intersectionList) { +otherTypes.addAll(intersection); +} +for (final Resource other : otherTypes) { +// :A intersectionOf[:B, :C] implies that +// :A subclassOf :B +// :A subclassOf :C +// So add each type that's part of the intersection to the +// subClassOf graph. +addSubClassOf(type, other); +
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565270 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - propURI = iter2Statement.getObject(); -
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565184 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - propURI = iter2Statement.getObject(); -
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129392#comment-16129392 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565184 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); -
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129393#comment-16129393 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565201 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); -
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129391#comment-16129391 ] ASF GitHub Bot commented on RYA-292: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565124 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/IntersectionOfVisitor.java --- @@ -0,0 +1,159 @@ +/* + * 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 java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.apache.log4j.Logger; +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.openrdf.model.Resource; +import org.openrdf.model.URI; +import org.openrdf.model.vocabulary.RDF; +import org.openrdf.query.algebra.StatementPattern; +import org.openrdf.query.algebra.TupleExpr; +import org.openrdf.query.algebra.Union; +import org.openrdf.query.algebra.Var; + +/** + * Visitor for handling owl:intersectionOf inferencing on a node. + */ +public class IntersectionOfVisitor extends AbstractInferVisitor { +private static final Logger log = Logger.getLogger(IntersectionOfVisitor.class); + +/** + * Creates a new instance of {@link IntersectionOfVisitor}. + * @param conf the {@link RdfCloudeTripleStoreConfiguration}. + * @param inferenceEngine the {@link InferenceEngine}. + */ +public IntersectionOfVisitor(final RdfCloudTripleStoreConfiguration conf, final InferenceEngine inferenceEngine) { +super(conf, inferenceEngine); +include = true; +} + +@Override +protected void meetSP(final StatementPattern node) throws Exception { +final StatementPattern currentNode = node.clone(); +final Var subVar = node.getSubjectVar(); +final Var predVar = node.getPredicateVar(); +final Var objVar = node.getObjectVar(); +final Var conVar = node.getContextVar(); +if (predVar != null && objVar != null && objVar.getValue() != null && RDF.TYPE.equals(predVar.getValue()) && !EXPANDED.equals(conVar)) { +final List> intersections = inferenceEngine.getIntersectionsImplying((URI) objVar.getValue()); +if (intersections != null && !intersections.isEmpty()) { +final Set combinedIntersections = new TreeSet<>(new ResourceComparator()); --- End diff -- Done. Created a union tree of joins for each intersection. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565201 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - propURI = iter2Statement.getObject(); -
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133565124 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/IntersectionOfVisitor.java --- @@ -0,0 +1,159 @@ +/* + * 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 java.util.ArrayList; +import java.util.Comparator; +import java.util.List; +import java.util.Set; +import java.util.TreeSet; + +import org.apache.log4j.Logger; +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.openrdf.model.Resource; +import org.openrdf.model.URI; +import org.openrdf.model.vocabulary.RDF; +import org.openrdf.query.algebra.StatementPattern; +import org.openrdf.query.algebra.TupleExpr; +import org.openrdf.query.algebra.Union; +import org.openrdf.query.algebra.Var; + +/** + * Visitor for handling owl:intersectionOf inferencing on a node. + */ +public class IntersectionOfVisitor extends AbstractInferVisitor { +private static final Logger log = Logger.getLogger(IntersectionOfVisitor.class); + +/** + * Creates a new instance of {@link IntersectionOfVisitor}. + * @param conf the {@link RdfCloudeTripleStoreConfiguration}. + * @param inferenceEngine the {@link InferenceEngine}. + */ +public IntersectionOfVisitor(final RdfCloudTripleStoreConfiguration conf, final InferenceEngine inferenceEngine) { +super(conf, inferenceEngine); +include = true; +} + +@Override +protected void meetSP(final StatementPattern node) throws Exception { +final StatementPattern currentNode = node.clone(); +final Var subVar = node.getSubjectVar(); +final Var predVar = node.getPredicateVar(); +final Var objVar = node.getObjectVar(); +final Var conVar = node.getContextVar(); +if (predVar != null && objVar != null && objVar.getValue() != null && RDF.TYPE.equals(predVar.getValue()) && !EXPANDED.equals(conVar)) { +final List> intersections = inferenceEngine.getIntersectionsImplying((URI) objVar.getValue()); +if (intersections != null && !intersections.isEmpty()) { +final Set combinedIntersections = new TreeSet<>(new ResourceComparator()); --- End diff -- Done. Created a union tree of joins for each intersection. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #208: fix-mongo-tests
Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/208 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-343) AccumuloLoadStatementsFile fails when loading data to a PCJ-enabled table.
[ https://issues.apache.org/jira/browse/RYA-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129308#comment-16129308 ] ASF GitHub Bot commented on RYA-343: Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/205 > AccumuloLoadStatementsFile fails when loading data to a PCJ-enabled table. > -- > > Key: RYA-343 > URL: https://issues.apache.org/jira/browse/RYA-343 > Project: Rya > Issue Type: Sub-task > Components: clients >Reporter: Jeff Dasch >Assignee: Jeff Dasch > > Issue occurs when calling {{AccumuloLoadStatementsFile.loadStatements()}} to > loading data to a PCJ-enabled table. I believe this is a recent regression. > {noformat} > 2017-08-14 13:46:51,802 [Spring Shell] WARN > org.apache.rya.api.client.accumulo.AccumuloLoadStatementsFile - Exception > while loading: > org.apache.rya.api.persist.RyaDAOException: > java.lang.IllegalArgumentException: The 'rya.indexing.pcj.storageType' > property must have one of the following values: [ACCUMULO] > at org.apache.rya.accumulo.AccumuloRyaDAO.init(AccumuloRyaDAO.java:165) > at > org.apache.rya.sail.config.RyaSailFactory.getAccumuloDAO(RyaSailFactory.java:155) > at > org.apache.rya.sail.config.RyaSailFactory.getRyaSail(RyaSailFactory.java:100) > at > org.apache.rya.sail.config.RyaSailFactory.getInstance(RyaSailFactory.java:67) > at > org.apache.rya.api.client.accumulo.AccumuloLoadStatementsFile.loadStatements(AccumuloLoadStatementsFile.java:91) > at org.apache.rya.shell.RyaCommands.loadData(RyaCommands.java:121) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:210) > at > org.springframework.shell.core.SimpleExecutionStrategy.invoke(SimpleExecutionStrategy.java:64) > at > org.springframework.shell.core.SimpleExecutionStrategy.execute(SimpleExecutionStrategy.java:57) > at > org.springframework.shell.core.AbstractShell.executeCommand(AbstractShell.java:127) > at > org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:533) > at org.springframework.shell.core.JLineShell.run(JLineShell.java:179) > at java.lang.Thread.run(Thread.java:748) > Caused by: java.lang.IllegalArgumentException: The > 'rya.indexing.pcj.storageType' property must have one of the following > values: [ACCUMULO] > at > com.google.common.base.Preconditions.checkArgument(Preconditions.java:92) > at > org.apache.rya.indexing.external.PrecomputedJoinStorageSupplier.get(PrecomputedJoinStorageSupplier.java:68) > at > org.apache.rya.indexing.external.PrecomputedJoinIndexer.init(PrecomputedJoinIndexer.java:139) > at org.apache.rya.accumulo.AccumuloRyaDAO.init(AccumuloRyaDAO.java:156) > ... 16 more > {noformat} -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #205: RYA-343 Fixed rya.api connection issue for ...
Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/205 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Created] (RYA-345) KafkaBindingSetExporterFactory does not support multiple Kafka bootstrap servers.
Jeff Dasch created RYA-345: -- Summary: KafkaBindingSetExporterFactory does not support multiple Kafka bootstrap servers. Key: RYA-345 URL: https://issues.apache.org/jira/browse/RYA-345 Project: Rya Issue Type: Improvement Components: build Affects Versions: 3.2.10 Reporter: Jeff Dasch Priority: Minor KafkaBindingSetExporterFactory needs to be updated to be able to handle a CSV (or ;SV) for the key ProducerConfig.BOOTSTRAP_SERVERS_CONFIG in the event the user is providing multiple bootstrap servers for Kafka. This implementation would be similar to how RyaBindingSetExporterFactory handles the CSV for the zookeeper connect. An alternative option is to migrate to Fluo 1.1.0-incubating and implement an ObserverProvider. This may then eliminate the need for the above modification. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya issue #209: Rya 296 hasSelf
Github user asfgit commented on the issue: https://github.com/apache/incubator-rya/pull/209 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/401/Build result: FAILURE[...truncated 4.24 MB...][INFO] Apache Rya Spark Support ... SKIPPED[INFO] Apache Rya Web Projects SKIPPED[INFO] Apache Rya Web Implementation .. SKIPPED[INFO] [INFO] BUILD FAILURE[INFO] [INFO] Total time: 04:22 min[INFO] Finished at: 2017-08-16T17:22:03+00:00[INFO] Final Memory: 291M/2925M[INFO] [ERROR] Failed to execute goal org.apache.rat:apache-rat-plugin:0.11:check (check-licenses) on project rya.sail: Too many files with unapproved license: 1 See RAT report in: /home/jenkins/jenkins-slave/workspace/incubator-rya-master-with-optionals-pull-requests/sail/target/rat.txt -> [ Help 1][ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.[ERROR] Re-run Maven using the -X switch to enable full debug logging.[ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles:[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException[ERROR] [ERROR] After correcting the problems, you can resume the build with the command[ERROR] mvn -rf :rya.sailchannel stoppedSetting status of f6faef8aae068a67e1104ffa58d8ae1354dd921c to FAILURE with url https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/401/ and message: 'FAILURE 'Using context: Jenkins: clean package -Pgeoindexing --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-296) Implement owl:hasSelf inference
[ https://issues.apache.org/jira/browse/RYA-296?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129102#comment-16129102 ] ASF GitHub Bot commented on RYA-296: GitHub user isper3at opened a pull request: https://github.com/apache/incubator-rya/pull/209 Rya 296 hasSelf ## Description >What Changed? Added rule for hasSelf to inferencing ### Tests >Coverage? tests for hasSelf from type, inferring property tests for hasSelf from property with constant subject, inferring type tests for hasSelf from property with constant object, inferring type ### Links [Jira](https://issues.apache.org/jira/browse/RYA-296) ### Checklist - [ ] Code Review - [ ] Squash Commits People To Reivew @jessehatfield - give extra scrutiny towards the tests, I want to make sure it was all done correctly @meiercaleb @ejwhite922 You can merge this pull request into a Git repository by running: $ git pull https://github.com/isper3at/incubator-rya RYA-296 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-rya/pull/209.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 #209 commit bb517844298d43b00e4ac962aa0a9305405eda35 Author: isper3at Date: 2017-08-08T16:03:57Z CHECKPOINT commit 562defa09bab9f245018cc763fec07f6cfb65063 Author: isper3at Date: 2017-08-09T17:58:11Z CP commit f6faef8aae068a67e1104ffa58d8ae1354dd921c Author: isper3at Date: 2017-08-16T17:13:34Z RYA-296 add HasSelf inference rule Added has self along with tests > Implement owl:hasSelf inference > --- > > Key: RYA-296 > URL: https://issues.apache.org/jira/browse/RYA-296 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Andrew Smith > > An *{{owl:hasSelf}}* restriction defines the set of resources that are > connected to themselves by a specific property. > If the ontology states that a {{:Narcissist}} is a resource that {{:loves}} > itself, then the inference engine should: > 1. Rewrite queries of the form {{?x rdf:type :Narcissist}} to find all > resources matching {{?x :loves ?x}} (as well as anything explicitly stated to > be a :Narcissist) . > 2. Rewrite queries of either form {{:A :loves ?y}} or {{?z :loves :A}} to > match {{:A}} if {{:A}} is known to have the type {{:Narcissist}} . -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #209: Rya 296 hasSelf
GitHub user isper3at opened a pull request: https://github.com/apache/incubator-rya/pull/209 Rya 296 hasSelf ## Description >What Changed? Added rule for hasSelf to inferencing ### Tests >Coverage? tests for hasSelf from type, inferring property tests for hasSelf from property with constant subject, inferring type tests for hasSelf from property with constant object, inferring type ### Links [Jira](https://issues.apache.org/jira/browse/RYA-296) ### Checklist - [ ] Code Review - [ ] Squash Commits People To Reivew @jessehatfield - give extra scrutiny towards the tests, I want to make sure it was all done correctly @meiercaleb @ejwhite922 You can merge this pull request into a Git repository by running: $ git pull https://github.com/isper3at/incubator-rya RYA-296 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-rya/pull/209.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 #209 commit bb517844298d43b00e4ac962aa0a9305405eda35 Author: isper3at Date: 2017-08-08T16:03:57Z CHECKPOINT commit 562defa09bab9f245018cc763fec07f6cfb65063 Author: isper3at Date: 2017-08-09T17:58:11Z CP commit f6faef8aae068a67e1104ffa58d8ae1354dd921c Author: isper3at Date: 2017-08-16T17:13:34Z RYA-296 add HasSelf inference rule Added has self along with tests --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #198: Rya 283
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/198#discussion_r133497519 --- Diff: extras/rya.pcj.fluo/pcj.fluo.app/src/main/java/org/apache/rya/indexing/pcj/fluo/app/query/CommonNodeMetadata.java --- @@ -99,4 +99,18 @@ public String toString() { .append("}") .toString(); } + +/** + * Base interface for all metadata Builders. Using this type def + * allows for the implementation of a Builder visitor for navigating + * the Builder tree. + * + */ +public static interface Builder { --- End diff -- That's because it a type def that is meant to be extended. If a build method was added, it would have to pass back a type, which would make it necessary to cast for extensions of this class that pass back extensions of CommonNodeMetadata. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-297) Implement owl:equivalentClass inference
[ https://issues.apache.org/jira/browse/RYA-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16129006#comment-16129006 ] ASF GitHub Bot commented on RYA-297: Github user asfgit commented on the issue: https://github.com/apache/incubator-rya/pull/184 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/400/ > Implement owl:equivalentClass inference > --- > > Key: RYA-297 > URL: https://issues.apache.org/jira/browse/RYA-297 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Jesse Hatfield > > An *{{owl:equivalentClass}}* statement is equivalent to stating that two > classes are each subclasses of the other. > The inference engine already supports subclass reasoning, but appears not to > check for equivalent class statements. This can likely be handled by adding > the relationship to the subclass graph in both directions, as seems to be > done for equivalent properties. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya issue #184: RYA-297 Added owl:equivalentClass inference
Github user asfgit commented on the issue: https://github.com/apache/incubator-rya/pull/184 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/400/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-343) AccumuloLoadStatementsFile fails when loading data to a PCJ-enabled table.
[ https://issues.apache.org/jira/browse/RYA-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128961#comment-16128961 ] ASF GitHub Bot commented on RYA-343: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/205#discussion_r133485762 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/instance/RyaDetailsToConfiguration.java --- @@ -53,14 +53,16 @@ public static void addRyaDetailsToConfiguration(final RyaDetails details, final checkAndSet(conf, ConfigurationFields.USE_FREETEXT, details.getFreeTextIndexDetails().isEnabled()); //RYA-215checkAndSet(conf, ConfigurationFields.USE_GEO, details.getGeoIndexDetails().isEnabled()); checkAndSet(conf, ConfigurationFields.USE_TEMPORAL, details.getTemporalIndexDetails().isEnabled()); -PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); - if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); - conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); - conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); - } else { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); - } +final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); +if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); +conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); +conf.set(ConfigurationFields.PCJ_STORAGE_TYPE, "ACCUMULO"); +} else { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "NO_UPDATE"); --- End diff -- This issue has been created https://issues.apache.org/jira/browse/RYA-344. > AccumuloLoadStatementsFile fails when loading data to a PCJ-enabled table. > -- > > Key: RYA-343 > URL: https://issues.apache.org/jira/browse/RYA-343 > Project: Rya > Issue Type: Sub-task > Components: clients >Reporter: Jeff Dasch >Assignee: Jeff Dasch > > Issue occurs when calling {{AccumuloLoadStatementsFile.loadStatements()}} to > loading data to a PCJ-enabled table. I believe this is a recent regression. > {noformat} > 2017-08-14 13:46:51,802 [Spring Shell] WARN > org.apache.rya.api.client.accumulo.AccumuloLoadStatementsFile - Exception > while loading: > org.apache.rya.api.persist.RyaDAOException: > java.lang.IllegalArgumentException: The 'rya.indexing.pcj.storageType' > property must have one of the following values: [ACCUMULO] > at org.apache.rya.accumulo.AccumuloRyaDAO.init(AccumuloRyaDAO.java:165) > at > org.apache.rya.sail.config.RyaSailFactory.getAccumuloDAO(RyaSailFactory.java:155) > at > org.apache.rya.sail.config.RyaSailFactory.getRyaSail(RyaSailFactory.java:100) > at > org.apache.rya.sail.config.RyaSailFactory.getInstance(RyaSailFactory.java:67) > at > org.apache.rya.api.client.accumulo.AccumuloLoadStatementsFile.loadStatements(AccumuloLoadStatementsFile.java:91) > at org.apache.rya.shell.RyaCommands.loadData(RyaCommands.java:121) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:210) > at > org.springframework.shell.core.SimpleExecutionStrategy.invoke(SimpleExecutionStrategy.java:64) > at > org.springframework.shell.core.SimpleExecutionStrategy.execute(SimpleExecutionStrategy.java:57) > at > org.springframework.shell.core.AbstractShell.executeCommand(AbstractShell.java:127) > at > org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:533) > at org.springframework.shell.core.JLineShell.run(JLineShell.java:179) > at java.lang.Thread.run(Thread.java:748) > Caused by: java.lang.IllegalArgumentException: The > 'rya.indexing.pcj.storageType' property must have one of the following > values: [ACCUMULO] > at > com.google.common.base.Preconditions.checkArgument(Preconditions.java:92) >
[GitHub] incubator-rya pull request #205: RYA-343 Fixed rya.api connection issue for ...
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/205#discussion_r133485762 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/instance/RyaDetailsToConfiguration.java --- @@ -53,14 +53,16 @@ public static void addRyaDetailsToConfiguration(final RyaDetails details, final checkAndSet(conf, ConfigurationFields.USE_FREETEXT, details.getFreeTextIndexDetails().isEnabled()); //RYA-215checkAndSet(conf, ConfigurationFields.USE_GEO, details.getGeoIndexDetails().isEnabled()); checkAndSet(conf, ConfigurationFields.USE_TEMPORAL, details.getTemporalIndexDetails().isEnabled()); -PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); - if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); - conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); - conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); - } else { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); - } +final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); +if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); +conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); +conf.set(ConfigurationFields.PCJ_STORAGE_TYPE, "ACCUMULO"); +} else { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "NO_UPDATE"); --- End diff -- This issue has been created https://issues.apache.org/jira/browse/RYA-344. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Updated] (RYA-344) Add GetStorageType Getter to RyaDetails
[ https://issues.apache.org/jira/browse/RYA-344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Caleb Meier updated RYA-344: Summary: Add GetStorageType Getter to RyaDetails (was: Add Get Storage Type Getter to RyaDetails) > Add GetStorageType Getter to RyaDetails > --- > > Key: RYA-344 > URL: https://issues.apache.org/jira/browse/RYA-344 > Project: Rya > Issue Type: Improvement > Components: clients >Affects Versions: 3.2.10 >Reporter: Caleb Meier >Assignee: Caleb Meier > > Because of how Rya is currently packaged, it is difficult to configure Rya to > use the PrecomputedJoinIndexer when ingesting triples into Rya via the Rya > shell. This is in large part due to certain configuration constants not > being accessible at the API level (which is where the CLI interfaces and > other essential classes used for configuring the underlying CLI client are > located). In particular, when the configuration object created by the CLI is > modified by the RyaSailFactory (so that it is consistent with the underlying > Rya instance), it cannot set key configuration parameters to use the > PrecomputedJoinIndex (if one is enabled). The RyaDetails object currently > doesn't provide a way to determine the PrecomputedJoinStorageType (as defined > in org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig) for the > underlying PCJs. A getter method that provides this storage type needs to be > added to the RyaDetails interface. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Updated] (RYA-344) Add Get Storage Type Getter to RyaDetails
[ https://issues.apache.org/jira/browse/RYA-344?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Caleb Meier updated RYA-344: Description: Because of how Rya is currently packaged, it is difficult to configure Rya to use the PrecomputedJoinIndexer when ingesting triples into Rya via the Rya shell. This is in large part due to certain configuration constants not being accessible at the API level (which is where the CLI interfaces and other essential classes used for configuring the underlying CLI client are located). In particular, when the configuration object created by the CLI is modified by the RyaSailFactory (so that it is consistent with the underlying Rya instance), it cannot set key configuration parameters to use the PrecomputedJoinIndex (if one is enabled). The RyaDetails object currently doesn't provide a way to determine the PrecomputedJoinStorageType (as defined in org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig) for the underlying PCJs. A getter method that provides this storage type needs to be added to the RyaDetails interface. (was: Because of how Rya is currently packaged, it is difficult to configure Rya to use the PrecomputedJoinIndexer when ingesting triples into Rya via the Rya shell. This is large part due to certain configuration constants not being accessible at the API level (which is where the CLI interfaces and other essential classes used for configuring the underlying CLI client are located). In particular, when the configuration object created by the CLI is modified by the RyaSailFactory (so that it is consistent with the underlying Rya instance), it cannot set key configuration parameters to use the PrecomputedJoinIndex (if one is enabled). The RyaDetails object currently doesn't provide a way to determine the Storage Type for the underlying PCJs. A getter method that provides this storage type needs to be added.) > Add Get Storage Type Getter to RyaDetails > - > > Key: RYA-344 > URL: https://issues.apache.org/jira/browse/RYA-344 > Project: Rya > Issue Type: Improvement > Components: clients >Affects Versions: 3.2.10 >Reporter: Caleb Meier >Assignee: Caleb Meier > > Because of how Rya is currently packaged, it is difficult to configure Rya to > use the PrecomputedJoinIndexer when ingesting triples into Rya via the Rya > shell. This is in large part due to certain configuration constants not > being accessible at the API level (which is where the CLI interfaces and > other essential classes used for configuring the underlying CLI client are > located). In particular, when the configuration object created by the CLI is > modified by the RyaSailFactory (so that it is consistent with the underlying > Rya instance), it cannot set key configuration parameters to use the > PrecomputedJoinIndex (if one is enabled). The RyaDetails object currently > doesn't provide a way to determine the PrecomputedJoinStorageType (as defined > in org.apache.rya.indexing.external.PrecomputedJoinIndexerConfig) for the > underlying PCJs. A getter method that provides this storage type needs to be > added to the RyaDetails interface. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Created] (RYA-344) Add Get Storage Type Getter to RyaDetails
Caleb Meier created RYA-344: --- Summary: Add Get Storage Type Getter to RyaDetails Key: RYA-344 URL: https://issues.apache.org/jira/browse/RYA-344 Project: Rya Issue Type: Improvement Components: clients Affects Versions: 3.2.10 Reporter: Caleb Meier Assignee: Caleb Meier Because of how Rya is currently packaged, it is difficult to configure Rya to use the PrecomputedJoinIndexer when ingesting triples into Rya via the Rya shell. This is large part due to certain configuration constants not being accessible at the API level (which is where the CLI interfaces and other essential classes used for configuring the underlying CLI client are located). In particular, when the configuration object created by the CLI is modified by the RyaSailFactory (so that it is consistent with the underlying Rya instance), it cannot set key configuration parameters to use the PrecomputedJoinIndex (if one is enabled). The RyaDetails object currently doesn't provide a way to determine the Storage Type for the underlying PCJs. A getter method that provides this storage type needs to be added. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128942#comment-16128942 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133448942 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { --- End diff -- Yeah, I agree with Jesse here. We should avoid creating interfaces/classes that provide the same functionality as preexisting interfaces/classes. Use the RDFHandler here. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128947#comment-16128947 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133455337 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoStatementIterHandler.java --- @@ -0,0 +1,35 @@ +/* + * 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.api.persist.utils; + +import org.apache.rya.api.persist.RyaDAO; +import org.openrdf.model.Statement; + +/** + * Handles the statements returned from a {@link RyaDAO} query iterator. + */ +public abstract class RyaDaoStatementIterHandler { --- End diff -- Use the RDFHandler interface. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128945#comment-16128945 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133467895 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . +ryaDaoQueryWrapper.queryAll(null, OWL.INTERSECTIONOF, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st1) throws Exception { +final Resource type = st1.getSubject(); +// head will point to a type that is part of the intersection. +URI head = (URI) st1.getObject(); +if (!intersectionsProp.containsKey(type)) { +intersectionsProp.put(type, new ArrayList>()); +} +final Set intersection = new HashSet<>(); +// Go through and find all bnodes that are part of the defined +// intersection. +while (!RDF.NIL.equals(head)) { +// rdf.first will point to a type item that is in the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.FIRST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st2) throws Exception{ +// The object found in the query represents a type +// that should be included in the intersection. +final URI obj2 = (URI) st2.getObject(); +intersection.add(obj2); +} +}); +final List headHolder = new ArrayList<>(1); +// rdf.rest will point to the next bnode that's part of the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.REST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st3) throws Exception { +// This object is the next bnode head to look for. +final URI obj3 = (URI) st3.getObject(); +headHolder.add(obj3); +} +}); +// As long as we get a new head there are more bnodes that +// are part of the intersection. Keep going until we reach +// rdf.nil. +if (!headHolder.isEmpty()) { +head = headHolder.get(0); +} else { +head = RDF.NIL; +} +} +// Add this intersection for this type. There may be more +// intersections for this type so each type has a list of +// intersection sets. +intersectionsProp.get(type).add(intersection); --- End diff -- Thanks for clarifying the need for the list of sets. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersectio
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128943#comment-16128943 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133458754 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/ReorderJoinVisitor.java --- @@ -31,24 +31,24 @@ * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class ReorderJoinVisitor extends QueryModelVisitorBase { +public class ReorderJoinVisitor extends QueryModelVisitorBase { --- End diff -- Same as above. Looks like you just added final everywhere. Was this intentional or just a by-product of your eclipse formatting settings? Are these visitors important for the intersectionOf query expansion? Seems like that would just use the subClass visitor. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128940#comment-16128940 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133458015 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/FilterRangeVisitor.java --- @@ -27,63 +33,62 @@ import org.openrdf.model.Value; import org.openrdf.model.impl.BooleanLiteralImpl; import org.openrdf.query.QueryEvaluationException; -import org.openrdf.query.algebra.*; +import org.openrdf.query.algebra.Filter; +import org.openrdf.query.algebra.FunctionCall; +import org.openrdf.query.algebra.StatementPattern; +import org.openrdf.query.algebra.ValueConstant; +import org.openrdf.query.algebra.ValueExpr; +import org.openrdf.query.algebra.Var; import org.openrdf.query.algebra.helpers.QueryModelVisitorBase; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.apache.rya.api.RdfCloudTripleStoreConstants.RANGE; - /** * Class FilterTimeIndexVisitor * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class FilterRangeVisitor extends QueryModelVisitorBase { +public class FilterRangeVisitor extends QueryModelVisitorBase { -private RdfCloudTripleStoreConfiguration conf; -private Map rangeValues = new HashMap(); +private final RdfCloudTripleStoreConfiguration conf; +private final Map rangeValues = new HashMap(); -public FilterRangeVisitor(RdfCloudTripleStoreConfiguration conf) { +public FilterRangeVisitor(final RdfCloudTripleStoreConfiguration conf) { this.conf = conf; } @Override -public void meet(Filter node) throws Exception { +public void meet(final Filter node) throws Exception { --- End diff -- Were any substantive changes made to this file? Seems like you just added final everywhere. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128939#comment-16128939 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133454880 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { +checkNotNull(ryaDaoStatementIterHandler); +final CloseableIteration iter = RyaDAOHelper.query(ryaDao, subject, predicate, object, conf, contexts); +try { +while (iter.hasNext()) { +final Statement statement = iter.next(); +try { + ryaDaoStatementIterHandler.handleStatementIter(statement); +} catch (final Exception e) { +throw new QueryEvaluationException("Error handling statement.", e); +} +} +} finally { +if (iter != null) { +iter.close(); +} +} +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @par
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128946#comment-16128946 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133478457 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . +ryaDaoQueryWrapper.queryAll(null, OWL.INTERSECTIONOF, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st1) throws Exception { +final Resource type = st1.getSubject(); +// head will point to a type that is part of the intersection. +URI head = (URI) st1.getObject(); +if (!intersectionsProp.containsKey(type)) { +intersectionsProp.put(type, new ArrayList>()); +} +final Set intersection = new HashSet<>(); +// Go through and find all bnodes that are part of the defined +// intersection. +while (!RDF.NIL.equals(head)) { +// rdf.first will point to a type item that is in the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.FIRST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st2) throws Exception{ +// The object found in the query represents a type +// that should be included in the intersection. +final URI obj2 = (URI) st2.getObject(); +intersection.add(obj2); +} +}); +final List headHolder = new ArrayList<>(1); +// rdf.rest will point to the next bnode that's part of the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.REST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st3) throws Exception { +// This object is the next bnode head to look for. +final URI obj3 = (URI) st3.getObject(); +headHolder.add(obj3); +} +}); +// As long as we get a new head there are more bnodes that +// are part of the intersection. Keep going until we reach +// rdf.nil. +if (!headHolder.isEmpty()) { +head = headHolder.get(0); +} else { +head = RDF.NIL; +} +} +// Add this intersection for this type. There may be more +// intersections for this type so each type has a list of +// intersection sets. +intersectionsProp.get(type).add(intersection); +} +}); + +for (final Map.Entry>> entry : intersectionsProp.entrySet()) { +final Resource type = entry.getKey(); +final List> intersectionList = entry.getValue(); +final Set otherTypes = new HashSet<>(); +// Combine all of a type's intersections together. +for (final Set intersection : intersectionList) { +otherTypes.addAll(intersection); +} +for (final Resource other : otherTypes) { +// :A intersectionOf[:B, :C] implies that +
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128944#comment-16128944 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133462254 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); -
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133454880 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { +checkNotNull(ryaDaoStatementIterHandler); +final CloseableIteration iter = RyaDAOHelper.query(ryaDao, subject, predicate, object, conf, contexts); +try { +while (iter.hasNext()) { +final Statement statement = iter.next(); +try { + ryaDaoStatementIterHandler.handleStatementIter(statement); +} catch (final Exception e) { +throw new QueryEvaluationException("Error handling statement.", e); +} +} +} finally { +if (iter != null) { +iter.close(); +} +} +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param statement the {@link Statement} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @throws QueryEvaluationE
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128936#comment-16128936 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133458153 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/PushJoinDownVisitor.java --- @@ -30,26 +30,26 @@ * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class PushJoinDownVisitor extends QueryModelVisitorBase { +public class PushJoinDownVisitor extends QueryModelVisitorBase { @Override -public void meet(Join node) throws Exception { +public void meet(final Join node) throws Exception { --- End diff -- Same as above. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128941#comment-16128941 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133450932 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { +checkNotNull(ryaDaoStatementIterHandler); +final CloseableIteration iter = RyaDAOHelper.query(ryaDao, subject, predicate, object, conf, contexts); +try { +while (iter.hasNext()) { +final Statement statement = iter.next(); +try { + ryaDaoStatementIterHandler.handleStatementIter(statement); +} catch (final Exception e) { +throw new QueryEvaluationException("Error handling statement.", e); +} +} +} finally { +if (iter != null) { +iter.close(); +} +} +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @par
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128937#comment-16128937 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133461212 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -178,11 +183,15 @@ public void refreshGraph() throws InferenceEngineException { subPropertyOfGraph = graph; //TODO: Should this be synchronized? + +refreshIntersectionOf(); --- End diff -- Awesome! Thanks for separating out the intersection refresh logic here. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference
[ https://issues.apache.org/jira/browse/RYA-292?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128938#comment-16128938 ] ASF GitHub Bot commented on RYA-292: Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133465643 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . --- End diff -- Thanks for documenting this. It really helps clarify the logic. > Implement owl:intersectionOf inference > -- > > Key: RYA-292 > URL: https://issues.apache.org/jira/browse/RYA-292 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Eric White > > An *{{owl:intersectionOf}}* expression defines the set of resources who > belong to all of a particular set of classes. > A basic implementation, if the ontology states that {{:Mother}} is the > intersection of {{:Parent}} and {{:Woman}}, should cause the inference engine > to: > 1. Rewrite query patterns {{?x rdf:type :Mother}} (the intersection type) to > check for resources that have both types {{:Parent}} and {{:Woman}} (as well > as check for resources that are explicitly stated to be {{:Mother}} s) > 2. Rewrite query patterns {{?y rdf:type :Parent}} (one of the intersecting > sets) to check for resources that are stated to be either {{:Mother}} or > {{:Parent}} , since belonging to the intersection type implies membership in > the component types. (Equivalent logic applies to {{Woman}} ) -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133461212 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -178,11 +183,15 @@ public void refreshGraph() throws InferenceEngineException { subPropertyOfGraph = graph; //TODO: Should this be synchronized? + +refreshIntersectionOf(); --- End diff -- Awesome! Thanks for separating out the intersection refresh logic here. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133467895 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . +ryaDaoQueryWrapper.queryAll(null, OWL.INTERSECTIONOF, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st1) throws Exception { +final Resource type = st1.getSubject(); +// head will point to a type that is part of the intersection. +URI head = (URI) st1.getObject(); +if (!intersectionsProp.containsKey(type)) { +intersectionsProp.put(type, new ArrayList>()); +} +final Set intersection = new HashSet<>(); +// Go through and find all bnodes that are part of the defined +// intersection. +while (!RDF.NIL.equals(head)) { +// rdf.first will point to a type item that is in the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.FIRST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st2) throws Exception{ +// The object found in the query represents a type +// that should be included in the intersection. +final URI obj2 = (URI) st2.getObject(); +intersection.add(obj2); +} +}); +final List headHolder = new ArrayList<>(1); +// rdf.rest will point to the next bnode that's part of the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.REST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st3) throws Exception { +// This object is the next bnode head to look for. +final URI obj3 = (URI) st3.getObject(); +headHolder.add(obj3); +} +}); +// As long as we get a new head there are more bnodes that +// are part of the intersection. Keep going until we reach +// rdf.nil. +if (!headHolder.isEmpty()) { +head = headHolder.get(0); +} else { +head = RDF.NIL; +} +} +// Add this intersection for this type. There may be more +// intersections for this type so each type has a list of +// intersection sets. +intersectionsProp.get(type).add(intersection); --- End diff -- Thanks for clarifying the need for the list of sets. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133448942 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { --- End diff -- Yeah, I agree with Jesse here. We should avoid creating interfaces/classes that provide the same functionality as preexisting interfaces/classes. Use the RDFHandler here. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133458015 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/FilterRangeVisitor.java --- @@ -27,63 +33,62 @@ import org.openrdf.model.Value; import org.openrdf.model.impl.BooleanLiteralImpl; import org.openrdf.query.QueryEvaluationException; -import org.openrdf.query.algebra.*; +import org.openrdf.query.algebra.Filter; +import org.openrdf.query.algebra.FunctionCall; +import org.openrdf.query.algebra.StatementPattern; +import org.openrdf.query.algebra.ValueConstant; +import org.openrdf.query.algebra.ValueExpr; +import org.openrdf.query.algebra.Var; import org.openrdf.query.algebra.helpers.QueryModelVisitorBase; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.apache.rya.api.RdfCloudTripleStoreConstants.RANGE; - /** * Class FilterTimeIndexVisitor * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class FilterRangeVisitor extends QueryModelVisitorBase { +public class FilterRangeVisitor extends QueryModelVisitorBase { -private RdfCloudTripleStoreConfiguration conf; -private Map rangeValues = new HashMap(); +private final RdfCloudTripleStoreConfiguration conf; +private final Map rangeValues = new HashMap(); -public FilterRangeVisitor(RdfCloudTripleStoreConfiguration conf) { +public FilterRangeVisitor(final RdfCloudTripleStoreConfiguration conf) { this.conf = conf; } @Override -public void meet(Filter node) throws Exception { +public void meet(final Filter node) throws Exception { --- End diff -- Were any substantive changes made to this file? Seems like you just added final everywhere. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133458153 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/PushJoinDownVisitor.java --- @@ -30,26 +30,26 @@ * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class PushJoinDownVisitor extends QueryModelVisitorBase { +public class PushJoinDownVisitor extends QueryModelVisitorBase { @Override -public void meet(Join node) throws Exception { +public void meet(final Join node) throws Exception { --- End diff -- Same as above. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133455337 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoStatementIterHandler.java --- @@ -0,0 +1,35 @@ +/* + * 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.api.persist.utils; + +import org.apache.rya.api.persist.RyaDAO; +import org.openrdf.model.Statement; + +/** + * Handles the statements returned from a {@link RyaDAO} query iterator. + */ +public abstract class RyaDaoStatementIterHandler { --- End diff -- Use the RDFHandler interface. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133462254 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -220,163 +229,163 @@ public void refreshGraph() throws InferenceEngineException { } } inverseOfMap = invProp; - -ValueFactory vf = ValueFactoryImpl.getInstance(); -iter = RyaDAOHelper.query(ryaDAO, null, - vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), - null, conf); -Map propertyChainPropertiesToBNodes = new HashMap(); -propertyChainPropertyToChain = new HashMap>(); + +final ValueFactory vf = ValueFactoryImpl.getInstance(); +iter = RyaDAOHelper.query(ryaDAO, null, + vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";), +null, conf); +final Map propertyChainPropertiesToBNodes = new HashMap<>(); +propertyChainPropertyToChain = new HashMap<>(); try { - while (iter.hasNext()){ - Statement st = iter.next(); - propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); - } +while (iter.hasNext()){ +final Statement st = iter.next(); + propertyChainPropertiesToBNodes.put((URI)st.getSubject(), (URI)st.getObject()); +} } finally { if (iter != null) { iter.close(); } } // now for each property chain bNode, get the indexed list of properties associated with that chain -for (URI propertyChainProperty : propertyChainPropertiesToBNodes.keySet()){ - URI bNode = propertyChainPropertiesToBNodes.get(propertyChainProperty); - // query for the list of indexed properties - iter = RyaDAOHelper.query(ryaDAO, bNode, vf.createURI("http://www.w3.org/2000/10/swap/list#index";), - null, conf); - TreeMap orderedProperties = new TreeMap(); - // TODO refactor this. Wish I could execute sparql - try { - while (iter.hasNext()){ - Statement st = iter.next(); - String indexedElement = st.getObject().stringValue(); - System.out.println(indexedElement); - CloseableIteration iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.FIRST, - null, conf); - String integerValue = ""; - Value anonPropNode = null; - Value propURI = null; - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - integerValue = iter2Statement.getObject().stringValue(); - break; - } - iter2.close(); - } - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(st.getObject().stringValue()), RDF.REST, - null, conf); - if (iter2 != null){ - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - anonPropNode = iter2Statement.getObject(); - break; - } - iter2.close(); - if (anonPropNode != null){ - iter2 = RyaDAOHelper.query(ryaDAO, vf.createURI(anonPropNode.stringValue()), RDF.FIRST, - null, conf); - while (iter2.hasNext()){ - Statement iter2Statement = iter2.next(); - propURI = iter2Statement.getObject(); -
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133478457 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . +ryaDaoQueryWrapper.queryAll(null, OWL.INTERSECTIONOF, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st1) throws Exception { +final Resource type = st1.getSubject(); +// head will point to a type that is part of the intersection. +URI head = (URI) st1.getObject(); +if (!intersectionsProp.containsKey(type)) { +intersectionsProp.put(type, new ArrayList>()); +} +final Set intersection = new HashSet<>(); +// Go through and find all bnodes that are part of the defined +// intersection. +while (!RDF.NIL.equals(head)) { +// rdf.first will point to a type item that is in the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.FIRST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st2) throws Exception{ +// The object found in the query represents a type +// that should be included in the intersection. +final URI obj2 = (URI) st2.getObject(); +intersection.add(obj2); +} +}); +final List headHolder = new ArrayList<>(1); +// rdf.rest will point to the next bnode that's part of the +// intersection. +ryaDaoQueryWrapper.queryFirst(head, RDF.REST, null, new RyaDaoStatementIterHandler() { +@Override +public void handleStatementIter(final Statement st3) throws Exception { +// This object is the next bnode head to look for. +final URI obj3 = (URI) st3.getObject(); +headHolder.add(obj3); +} +}); +// As long as we get a new head there are more bnodes that +// are part of the intersection. Keep going until we reach +// rdf.nil. +if (!headHolder.isEmpty()) { +head = headHolder.get(0); +} else { +head = RDF.NIL; +} +} +// Add this intersection for this type. There may be more +// intersections for this type so each type has a list of +// intersection sets. +intersectionsProp.get(type).add(intersection); +} +}); + +for (final Map.Entry>> entry : intersectionsProp.entrySet()) { +final Resource type = entry.getKey(); +final List> intersectionList = entry.getValue(); +final Set otherTypes = new HashSet<>(); +// Combine all of a type's intersections together. +for (final Set intersection : intersectionList) { +otherTypes.addAll(intersection); +} +for (final Resource other : otherTypes) { +// :A intersectionOf[:B, :C] implies that +// :A subclassOf :B +// :A subclassOf :C +// So add each type that's part of the intersection to the +// subClassOf graph. +addSubClassOf(type, other); +
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133458754 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/evaluation/ReorderJoinVisitor.java --- @@ -31,24 +31,24 @@ * Date: Apr 11, 2011 * Time: 10:16:15 PM */ -public class ReorderJoinVisitor extends QueryModelVisitorBase { +public class ReorderJoinVisitor extends QueryModelVisitorBase { --- End diff -- Same as above. Looks like you just added final everywhere. Was this intentional or just a by-product of your eclipse formatting settings? Are these visitors important for the intersectionOf query expansion? Seems like that would just use the subClass visitor. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133450932 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/persist/utils/RyaDaoQueryWrapper.java --- @@ -0,0 +1,179 @@ +/* + * 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.api.persist.utils; + +import static com.google.common.base.Preconditions.checkNotNull; + +import org.apache.rya.api.RdfCloudTripleStoreConfiguration; +import org.apache.rya.api.domain.RyaStatement; +import org.apache.rya.api.persist.RyaDAO; +import org.apache.rya.api.resolver.RyaToRdfConversions; +import org.openrdf.model.Resource; +import org.openrdf.model.Statement; +import org.openrdf.model.URI; +import org.openrdf.model.Value; +import org.openrdf.query.QueryEvaluationException; + +import info.aduna.iteration.CloseableIteration; + +/** + * Wraps Rya DAO queries into a simpler interface that just passes in the + * statement to query for and a handler for dealing with each statement in the + * query result. This handles iterating over the query, throwing any exceptions, + * and closing the query iterator when done. The same wrapper can be re-used + * for multiple queries. + */ +public class RyaDaoQueryWrapper { +private final RyaDAO ryaDao; +private final RdfCloudTripleStoreConfiguration conf; + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + * @param conf the {@link RdfCloudTripleStoreConfiguration}. + * (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao, final RdfCloudTripleStoreConfiguration conf) { +this.ryaDao = checkNotNull(ryaDao); +this.conf = checkNotNull(conf); +} + +/** + * Creates a new instance of {@link RyaDaoQueryWrapper}. + * @param ryaDao the {@link RyaDAO}. (not {@code null}) + */ +public RyaDaoQueryWrapper(final RyaDAO ryaDao) { +this(checkNotNull(ryaDao), ryaDao.getConf()); +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param subject the subject {@link Resource} to query for. + * @param predicate the predicate {@link URI} to query for. + * @param object the object {@link Value} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @param contexts the context {@link Resource}s to query for. + * @throws QueryEvaluationException + */ +public void queryAll(final Resource subject, final URI predicate, final Value object, final RyaDaoStatementIterHandler ryaDaoStatementIterHandler, final Resource... contexts) throws QueryEvaluationException { +checkNotNull(ryaDaoStatementIterHandler); +final CloseableIteration iter = RyaDAOHelper.query(ryaDao, subject, predicate, object, conf, contexts); +try { +while (iter.hasNext()) { +final Statement statement = iter.next(); +try { + ryaDaoStatementIterHandler.handleStatementIter(statement); +} catch (final Exception e) { +throw new QueryEvaluationException("Error handling statement.", e); +} +} +} finally { +if (iter != null) { +iter.close(); +} +} +} + +/** + * Handles all results of a query. Closes the query iterator when done. + * @param statement the {@link Statement} to query for. + * @param ryaDaoStatementIterHandler the {@link RyaDaoStatementIterHandler} + * to use for handling each statement returned. (not {@code null}) + * @throws QueryEvaluationE
[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.
Github user meiercaleb commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/206#discussion_r133465643 --- Diff: sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java --- @@ -416,22 +425,131 @@ private void refreshHasValueRestrictions(Map restrictions) throws } } -private static Vertex getVertex(Graph graph, Object id) { -Iterator it = graph.vertices(id.toString()); +private void refreshIntersectionOf() throws QueryEvaluationException { +final Map>> intersectionsProp = new HashMap<>(); + +// First query for all the owl:intersectionOf's. +// If we have the following intersectionOf: +// :A owl:intersectionOf[:B, :C] +// It will be represented by triples following a pattern similar to: +// <:A> owl:intersectionOf _:bnode1 . +// _:bnode1 rdf:first <:B> . +// _:bnode1 rdf:rest _:bnode2 . +// _:bnode2 rdf:first <:C> . +// _:bnode2 rdf:rest rdf:nil . --- End diff -- Thanks for documenting this. It really helps clarify the logic. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-343) AccumuloLoadStatementsFile fails when loading data to a PCJ-enabled table.
[ https://issues.apache.org/jira/browse/RYA-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128837#comment-16128837 ] ASF GitHub Bot commented on RYA-343: Github user jdasch commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/205#discussion_r133458983 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/instance/RyaDetailsToConfiguration.java --- @@ -53,14 +53,16 @@ public static void addRyaDetailsToConfiguration(final RyaDetails details, final checkAndSet(conf, ConfigurationFields.USE_FREETEXT, details.getFreeTextIndexDetails().isEnabled()); //RYA-215checkAndSet(conf, ConfigurationFields.USE_GEO, details.getGeoIndexDetails().isEnabled()); checkAndSet(conf, ConfigurationFields.USE_TEMPORAL, details.getTemporalIndexDetails().isEnabled()); -PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); - if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); - conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); - conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); - } else { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); - } +final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); +if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); +conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); +conf.set(ConfigurationFields.PCJ_STORAGE_TYPE, "ACCUMULO"); +} else { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "NO_UPDATE"); --- End diff -- I completely agree with you on not using the String literals. Unfortunately `PrecomputedJoinUpdaterType` is in rya.indexing and `RyaDetailsToConfiguration` is in rya.api, so I can't access that type. I believe (could be wrong) that Caleb had the action item to create (or reference) a JIRA that would enhance the `PCJIndexDetails` class to have a `PCJIndexDetails.getUpdaterType()` and `PCJIndexDetails.getStorageType()` methods, or perhaps we might go in some other direction with the implementation. > AccumuloLoadStatementsFile fails when loading data to a PCJ-enabled table. > -- > > Key: RYA-343 > URL: https://issues.apache.org/jira/browse/RYA-343 > Project: Rya > Issue Type: Sub-task > Components: clients >Reporter: Jeff Dasch >Assignee: Jeff Dasch > > Issue occurs when calling {{AccumuloLoadStatementsFile.loadStatements()}} to > loading data to a PCJ-enabled table. I believe this is a recent regression. > {noformat} > 2017-08-14 13:46:51,802 [Spring Shell] WARN > org.apache.rya.api.client.accumulo.AccumuloLoadStatementsFile - Exception > while loading: > org.apache.rya.api.persist.RyaDAOException: > java.lang.IllegalArgumentException: The 'rya.indexing.pcj.storageType' > property must have one of the following values: [ACCUMULO] > at org.apache.rya.accumulo.AccumuloRyaDAO.init(AccumuloRyaDAO.java:165) > at > org.apache.rya.sail.config.RyaSailFactory.getAccumuloDAO(RyaSailFactory.java:155) > at > org.apache.rya.sail.config.RyaSailFactory.getRyaSail(RyaSailFactory.java:100) > at > org.apache.rya.sail.config.RyaSailFactory.getInstance(RyaSailFactory.java:67) > at > org.apache.rya.api.client.accumulo.AccumuloLoadStatementsFile.loadStatements(AccumuloLoadStatementsFile.java:91) > at org.apache.rya.shell.RyaCommands.loadData(RyaCommands.java:121) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:210) > at > org.springframework.shell.core.SimpleExecutionStrategy.invoke(SimpleExecutionStrategy.java:64) > at > org.springframework.shell.core.SimpleExecutionStrategy.execute(SimpleExecutionStrategy.java:57) > at > org.springframework.shell.core.AbstractShell.executeCommand(AbstractShell.java:127) > at > org.springframe
[GitHub] incubator-rya pull request #205: RYA-343 Fixed rya.api connection issue for ...
Github user jdasch commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/205#discussion_r133458983 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/instance/RyaDetailsToConfiguration.java --- @@ -53,14 +53,16 @@ public static void addRyaDetailsToConfiguration(final RyaDetails details, final checkAndSet(conf, ConfigurationFields.USE_FREETEXT, details.getFreeTextIndexDetails().isEnabled()); //RYA-215checkAndSet(conf, ConfigurationFields.USE_GEO, details.getGeoIndexDetails().isEnabled()); checkAndSet(conf, ConfigurationFields.USE_TEMPORAL, details.getTemporalIndexDetails().isEnabled()); -PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); - if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); - conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); - conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); - } else { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); - } +final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); +if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); +conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); +conf.set(ConfigurationFields.PCJ_STORAGE_TYPE, "ACCUMULO"); +} else { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "NO_UPDATE"); --- End diff -- I completely agree with you on not using the String literals. Unfortunately `PrecomputedJoinUpdaterType` is in rya.indexing and `RyaDetailsToConfiguration` is in rya.api, so I can't access that type. I believe (could be wrong) that Caleb had the action item to create (or reference) a JIRA that would enhance the `PCJIndexDetails` class to have a `PCJIndexDetails.getUpdaterType()` and `PCJIndexDetails.getStorageType()` methods, or perhaps we might go in some other direction with the implementation. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Commented] (RYA-343) AccumuloLoadStatementsFile fails when loading data to a PCJ-enabled table.
[ https://issues.apache.org/jira/browse/RYA-343?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128823#comment-16128823 ] ASF GitHub Bot commented on RYA-343: Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/205#discussion_r133455098 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/instance/RyaDetailsToConfiguration.java --- @@ -53,14 +53,16 @@ public static void addRyaDetailsToConfiguration(final RyaDetails details, final checkAndSet(conf, ConfigurationFields.USE_FREETEXT, details.getFreeTextIndexDetails().isEnabled()); //RYA-215checkAndSet(conf, ConfigurationFields.USE_GEO, details.getGeoIndexDetails().isEnabled()); checkAndSet(conf, ConfigurationFields.USE_TEMPORAL, details.getTemporalIndexDetails().isEnabled()); -PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); - if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); - conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); - conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); - } else { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); - } +final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); +if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); +conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); +conf.set(ConfigurationFields.PCJ_STORAGE_TYPE, "ACCUMULO"); +} else { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "NO_UPDATE"); --- End diff -- I realize it was already like this but make use of the PrecomputedJoinUpdaterType and PrecomputedJoinStorageType enums in this method instead of hard-coded strings. Replace: "NO_UPDATE" with PrecomputedJoinUpdaterType.NO_UPDATE.toString(), "FLUO" with PrecomputedJoinUpdaterType.FLUO.toString(), and "ACCUMULO" with PrecomputedJoinStorageType.ACCUMULO.toString() > AccumuloLoadStatementsFile fails when loading data to a PCJ-enabled table. > -- > > Key: RYA-343 > URL: https://issues.apache.org/jira/browse/RYA-343 > Project: Rya > Issue Type: Sub-task > Components: clients >Reporter: Jeff Dasch >Assignee: Jeff Dasch > > Issue occurs when calling {{AccumuloLoadStatementsFile.loadStatements()}} to > loading data to a PCJ-enabled table. I believe this is a recent regression. > {noformat} > 2017-08-14 13:46:51,802 [Spring Shell] WARN > org.apache.rya.api.client.accumulo.AccumuloLoadStatementsFile - Exception > while loading: > org.apache.rya.api.persist.RyaDAOException: > java.lang.IllegalArgumentException: The 'rya.indexing.pcj.storageType' > property must have one of the following values: [ACCUMULO] > at org.apache.rya.accumulo.AccumuloRyaDAO.init(AccumuloRyaDAO.java:165) > at > org.apache.rya.sail.config.RyaSailFactory.getAccumuloDAO(RyaSailFactory.java:155) > at > org.apache.rya.sail.config.RyaSailFactory.getRyaSail(RyaSailFactory.java:100) > at > org.apache.rya.sail.config.RyaSailFactory.getInstance(RyaSailFactory.java:67) > at > org.apache.rya.api.client.accumulo.AccumuloLoadStatementsFile.loadStatements(AccumuloLoadStatementsFile.java:91) > at org.apache.rya.shell.RyaCommands.loadData(RyaCommands.java:121) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:498) > at > org.springframework.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:210) > at > org.springframework.shell.core.SimpleExecutionStrategy.invoke(SimpleExecutionStrategy.java:64) > at > org.springframework.shell.core.SimpleExecutionStrategy.execute(SimpleExecutionStrategy.java:57) > at > org.springframework.shell.core.AbstractShell.executeCommand(AbstractShell.java:127) > at > org.springframework.shell.core.JLineShell.promptLoop(JLineShell.java:533) > at org.springframework.shell.core.JLineShell.run(JLineShel
[GitHub] incubator-rya pull request #205: RYA-343 Fixed rya.api connection issue for ...
Github user ejwhite922 commented on a diff in the pull request: https://github.com/apache/incubator-rya/pull/205#discussion_r133455098 --- Diff: common/rya.api/src/main/java/org/apache/rya/api/instance/RyaDetailsToConfiguration.java --- @@ -53,14 +53,16 @@ public static void addRyaDetailsToConfiguration(final RyaDetails details, final checkAndSet(conf, ConfigurationFields.USE_FREETEXT, details.getFreeTextIndexDetails().isEnabled()); //RYA-215checkAndSet(conf, ConfigurationFields.USE_GEO, details.getGeoIndexDetails().isEnabled()); checkAndSet(conf, ConfigurationFields.USE_TEMPORAL, details.getTemporalIndexDetails().isEnabled()); -PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); - if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); - conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); - conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); - } else { - checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); - } +final PCJIndexDetails pcjDetails = details.getPCJIndexDetails(); +if (pcjDetails.isEnabled() && pcjDetails.getFluoDetails().isPresent()) { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, true); +conf.set(ConfigurationFields.FLUO_APP_NAME, pcjDetails.getFluoDetails().get().getUpdateAppName()); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "FLUO"); +conf.set(ConfigurationFields.PCJ_STORAGE_TYPE, "ACCUMULO"); +} else { +checkAndSet(conf, ConfigurationFields.USE_PCJ_UPDATER, false); +conf.set(ConfigurationFields.PCJ_UPDATER_TYPE, "NO_UPDATE"); --- End diff -- I realize it was already like this but make use of the PrecomputedJoinUpdaterType and PrecomputedJoinStorageType enums in this method instead of hard-coded strings. Replace: "NO_UPDATE" with PrecomputedJoinUpdaterType.NO_UPDATE.toString(), "FLUO" with PrecomputedJoinUpdaterType.FLUO.toString(), and "ACCUMULO" with PrecomputedJoinStorageType.ACCUMULO.toString() --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---
[jira] [Closed] (RYA-293) Implement owl:unionOf inference
[ https://issues.apache.org/jira/browse/RYA-293?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Caleb Meier closed RYA-293. --- Resolution: Fixed Fix Version/s: 3.2.10 > Implement owl:unionOf inference > --- > > Key: RYA-293 > URL: https://issues.apache.org/jira/browse/RYA-293 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Jesse Hatfield > Fix For: 3.2.10 > > > An *{{owl:unionOf}}* expression defines one type to be equivalent to the > union of another set of types. If the ontology states that {{:Parent}} is the > union of {{:Mother}} and {{:Father}}, then the inference engine should > rewrite statement patterns of the form {{?x rdf:type :Parent}} to check for > resources that are stated to be any of the types {{:Mother}}, {{:Father}}, or > {{:Parent}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[jira] [Commented] (RYA-293) Implement owl:unionOf inference
[ https://issues.apache.org/jira/browse/RYA-293?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16128813#comment-16128813 ] ASF GitHub Bot commented on RYA-293: Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/180 > Implement owl:unionOf inference > --- > > Key: RYA-293 > URL: https://issues.apache.org/jira/browse/RYA-293 > Project: Rya > Issue Type: Sub-task > Components: sail >Reporter: Jesse Hatfield >Assignee: Jesse Hatfield > > An *{{owl:unionOf}}* expression defines one type to be equivalent to the > union of another set of types. If the ontology states that {{:Parent}} is the > union of {{:Mother}} and {{:Father}}, then the inference engine should > rewrite statement patterns of the form {{?x rdf:type :Parent}} to check for > resources that are stated to be any of the types {{:Mother}}, {{:Father}}, or > {{:Parent}}. -- This message was sent by Atlassian JIRA (v6.4.14#64029)
[GitHub] incubator-rya pull request #180: RYA-293 Added owl:unionOf inference
Github user asfgit closed the pull request at: https://github.com/apache/incubator-rya/pull/180 --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---