[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference

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

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

ASF GitHub Bot commented on RYA-292:


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

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

[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference

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

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

ASF GitHub Bot commented on RYA-292:


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

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

[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.

2017-08-15 Thread jessehatfield
Github user jessehatfield commented on a diff in the pull request:

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

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

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

ASF GitHub Bot commented on RYA-292:


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

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

[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.

2017-08-15 Thread jessehatfield
Github user jessehatfield commented on a diff in the pull request:

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

[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference

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

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

ASF GitHub Bot commented on RYA-292:


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

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

[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.

2017-08-15 Thread jessehatfield
Github user jessehatfield commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/206#discussion_r133311778
  
--- 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();

[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.

2017-08-15 Thread jessehatfield
Github user jessehatfield commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/206#discussion_r133310947
  
--- 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();

[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference

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

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

ASF GitHub Bot commented on RYA-292:


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

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

[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference

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

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

ASF GitHub Bot commented on RYA-292:


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

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

Would it make sense to use the org.openrdf.rio.RDFHandler interface (and 
RDFHandlerBase) instead of a new handler class? That would let someone directly 
pass in something like an RDFWriter, if that were ever useful for something.


> 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 

[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.

2017-08-15 Thread jessehatfield
Github user jessehatfield commented on a diff in the pull request:

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

Would it make sense to use the org.openrdf.rio.RDFHandler interface (and 
RDFHandlerBase) instead of a new handler class? That would let someone directly 
pass in something like an RDFWriter, if that were ever useful for something.


---
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

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

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

ASF GitHub Bot commented on RYA-292:


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

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

If there are multiple intersections associated with the same type, I think 
we want to treat each intersection as a sufficient condition for inferring the 
type, and union their separate join trees together, rather than combining all 
the types into one join tree. E.g. if we have:

A intersectionOf (B C)
and
A intersectionOf (D E F)

then I think the right interpretation is: A == (B intersect C) ==  (D 
intersect E intersect F). So an individual x is a member of A if: (x is an A) 
OR (x is a B and a C) OR (x is a D and an E and an F). So the query tree would 
be something like:

- Union
  - Union
- Join
  - (x is a B)
  - (x is a C)
- Join
  - Join
- (x is a D)
- (x is an E)
  - (x is an F)
  - (x is an A)


> 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 

[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.

2017-08-15 Thread jessehatfield
Github user jessehatfield commented on a diff in the pull request:

https://github.com/apache/incubator-rya/pull/206#discussion_r133312263
  
--- 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();

[jira] [Commented] (RYA-292) Implement owl:intersectionOf inference

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

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

ASF GitHub Bot commented on RYA-292:


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

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

[GitHub] incubator-rya pull request #206: RYA-292 Added owl:intersectionOf inference.

2017-08-15 Thread jessehatfield
Github user jessehatfield commented on a diff in the pull request:

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

[GitHub] incubator-rya issue #208: fix-mongo-tests

2017-08-15 Thread asfgit
Github user asfgit commented on the issue:

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

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/399/



---
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

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

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

ASF GitHub Bot commented on RYA-340:


Github user asfgit commented on the issue:

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

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/395/



> 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 issue #207: RYA-340 Added dependency filtering to rya.pcj.fluo...

2017-08-15 Thread asfgit
Github user asfgit commented on the issue:

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

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/395/



---
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 issue #208: fix-mongo-tests

2017-08-15 Thread jdasch
Github user jdasch commented on the issue:

https://github.com/apache/incubator-rya/pull/208
  
asfbot build


---
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 issue #208: fix-mongo-tests

2017-08-15 Thread asfgit
Github user asfgit commented on the issue:

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

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/398/Build
 result: FAILURE[...truncated 385.36 KB...][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: 05:05 min[INFO] Finished at: 2017-08-15T20:56:45+00:00[INFO] Final 
Memory: 129M/3053M[INFO] 
[ERROR] 
Failed to execute goal 
org.apache.maven.plugins:maven-assembly-plugin:2.4.1:single (make-assembly) on 
project rya.pcj.fluo.app: Failed to create assembly: Error creating assembly 
archive jar-with-dependencies: Error finalizing component-set for archive. 
Reason: Permission den
 ied -> [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/MojoExecutionException[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the 
command[ERROR]   mvn  -rf :rya.pcj.fluo.appchannel stoppedSetting status 
of b2303f7705304851d800f864cb0d46345dac827c to FAILURE with url 
https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/398/
 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.
---


[GitHub] incubator-rya issue #208: fix-mongo-tests

2017-08-15 Thread asfgit
Github user asfgit commented on the issue:

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

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/397/Build
 result: FAILURE[...truncated 390.30 KB...][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:38 min[INFO] Finished at: 2017-08-15T20:51:51+00:00[INFO] Final 
Memory: 128M/3239M[INFO] 
[ERROR] 
Failed to execute goal 
org.apache.maven.plugins:maven-assembly-plugin:2.4.1:single (make-assembly) on 
project rya.pcj.fluo.app: Failed to create assembly: Error creating assembly 
archive jar-with-dependencies: Error finalizing component-set for archive. 
Reason: Permission den
 ied -> [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/MojoExecutionException[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the 
command[ERROR]   mvn  -rf :rya.pcj.fluo.appchannel stoppedSetting status 
of b2303f7705304851d800f864cb0d46345dac827c to FAILURE with url 
https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/397/
 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.
---


[GitHub] incubator-rya issue #208: fix-mongo-tests

2017-08-15 Thread jdasch
Github user jdasch commented on the issue:

https://github.com/apache/incubator-rya/pull/208
  
asfbot build


---
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 issue #208: fix-mongo-tests

2017-08-15 Thread jdasch
Github user jdasch commented on the issue:

https://github.com/apache/incubator-rya/pull/208
  
asfbot build


---
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 issue #208: fix-mongo-tests

2017-08-15 Thread asfgit
Github user asfgit commented on the issue:

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

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/396/Build
 result: FAILURE[...truncated 390.63 KB...][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:24 min[INFO] Finished at: 2017-08-15T20:43:20+00:00[INFO] Final 
Memory: 129M/3051M[INFO] 
[ERROR] 
Failed to execute goal 
org.apache.maven.plugins:maven-assembly-plugin:2.4.1:single (make-assembly) on 
project rya.pcj.fluo.app: Failed to create assembly: Error creating assembly 
archive jar-with-dependencies: Error finalizing component-set for archive. 
Reason: Permission den
 ied -> [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/MojoExecutionException[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the 
command[ERROR]   mvn  -rf :rya.pcj.fluo.appchannel stoppedSetting status 
of b2303f7705304851d800f864cb0d46345dac827c to FAILURE with url 
https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/396/
 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.
---


[GitHub] incubator-rya issue #208: fix-mongo-tests

2017-08-15 Thread jdasch
Github user jdasch commented on the issue:

https://github.com/apache/incubator-rya/pull/208
  
asfbot build


---
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 issue #207: RYA-340 Added dependency filtering to rya.pcj.fluo...

2017-08-15 Thread jdasch
Github user jdasch commented on the issue:

https://github.com/apache/incubator-rya/pull/207
  
asfbot build


---
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

2017-08-15 Thread jdasch
GitHub user jdasch opened a pull request:

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

fix-mongo-tests


## Description
MongoGeoTemporalIndexIT and MongoGeoIndexerFilterIT had 5 tests failing 
between them.
Updated to extend MongoITBase.  Added unique mongoDBs for isolation.

### Tests
MongoGeoTemporalIndexIT and MongoGeoIndexerFilterIT

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

 People To Reivew
@amihalik 
@meiercaleb 


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

$ git pull https://github.com/jdasch/incubator-rya fix-mongo-tests

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

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


commit b2303f7705304851d800f864cb0d46345dac827c
Author: jdasch 
Date:   2017-08-15T20:07:52Z

Updated to extend MongoITBase.  Added unique mongoDBs for isolation.




---
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

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

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

ASF GitHub Bot commented on RYA-340:


Github user asfgit commented on the issue:

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

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/393/Build
 result: FAILURE[...truncated 1.39 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: 10:34 min[INFO] Finished at: 2017-08-15T17:57:30+00:00[INFO] Final 
Memory: 141M/3074M[INFO] 
[ERROR] 
Failed to execute goal 
org.apache.maven.plugins:maven-assembly-plugin:2.4.1:single (make-assembly) on 
project rya.pcj.fluo.client: Failed to create assembly: Error creating assembly 
archive jar-with-dependencies: Error finalizing component-set for archive. 
Reason: Permission denied -> [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/MojoExecutionException[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the 
command[ERROR]   mvn  -rf :rya.pcj.fluo.clientchannel stoppedSetting 
status of 17acdce7e3f0a71112e22971943243cfacf3b658 to FAILURE with url 
https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/393/
 and message: 'FAILURE 'Using context: Jenkins: clean package -Pgeoindexing



> 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 
> 

[GitHub] incubator-rya issue #207: RYA-340 Added dependency filtering to rya.pcj.fluo...

2017-08-15 Thread asfgit
Github user asfgit commented on the issue:

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

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/393/Build
 result: FAILURE[...truncated 1.39 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: 10:34 min[INFO] Finished at: 2017-08-15T17:57:30+00:00[INFO] Final 
Memory: 141M/3074M[INFO] 
[ERROR] 
Failed to execute goal 
org.apache.maven.plugins:maven-assembly-plugin:2.4.1:single (make-assembly) on 
project rya.pcj.fluo.client: Failed to create assembly: Error creating assembly 
archive jar-with-dependencies: Error finalizing component-set for archive. 
Reason: Permission de
 nied -> [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/MojoExecutionException[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the 
command[ERROR]   mvn  -rf :rya.pcj.fluo.clientchannel stoppedSetting 
status of 17acdce7e3f0a71112e22971943243cfacf3b658 to FAILURE with url 
https://builds.apache.org/job/incubator-rya-master-with-optionals-pull-requests/393/
 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-340) rya.fluo.pcj.app is not currently deployable in fluo-1.0.0

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

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

ASF GitHub Bot commented on RYA-340:


GitHub user jdasch opened a pull request:

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

RYA-340 Added dependency filtering to rya.pcj.fluo.app for deployments.


## Description
- Added dependency filtering to rya.pcj.fluo.app for deployments.
- Also improved scoping of dependencies and dependencyManagement.
- Updated integration tests to use -Djava.net.preferIPv4Stack=true.

### Tests
Minor IT improvements in pom.  No code changes.

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

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

 People To Reivew
@amihalik 
@meiercaleb 


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

$ git pull https://github.com/jdasch/incubator-rya RYA-340

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

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


commit 17acdce7e3f0a71112e22971943243cfacf3b658
Author: jdasch 
Date:   2017-08-14T20:18:42Z

RYA-340 Added dependency filtering to rya.pcj.fluo.app for deployments.

- Also improved scoping of dependencies and dependencyManagement.
- Updated integration tests to use -Djava.net.preferIPv4Stack=true.




> 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...

2017-08-15 Thread jdasch
GitHub user jdasch opened a pull request:

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

RYA-340 Added dependency filtering to rya.pcj.fluo.app for deployments.


## Description
- Added dependency filtering to rya.pcj.fluo.app for deployments.
- Also improved scoping of dependencies and dependencyManagement.
- Updated integration tests to use -Djava.net.preferIPv4Stack=true.

### Tests
Minor IT improvements in pom.  No code changes.

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

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

 People To Reivew
@amihalik 
@meiercaleb 


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

$ git pull https://github.com/jdasch/incubator-rya RYA-340

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

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


commit 17acdce7e3f0a71112e22971943243cfacf3b658
Author: jdasch 
Date:   2017-08-14T20:18:42Z

RYA-340 Added dependency filtering to rya.pcj.fluo.app for deployments.

- Also improved scoping of dependencies and dependencyManagement.
- Updated integration tests to use -Djava.net.preferIPv4Stack=true.




---
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] [Assigned] (RYA-300) Implement owl:oneOf inference

2017-08-15 Thread Eric White (JIRA)

 [ 
https://issues.apache.org/jira/browse/RYA-300?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Eric White reassigned RYA-300:
--

Assignee: Eric White

> Implement owl:oneOf inference
> -
>
> Key: RYA-300
> URL: https://issues.apache.org/jira/browse/RYA-300
> Project: Rya
>  Issue Type: Sub-task
>  Components: sail
>Reporter: Jesse Hatfield
>Assignee: Eric White
>
> *{{owl:oneOf}}* defines an enumeration by associating a class with a list of 
> resources which belong to that class.
> If the ontology states that {{:PrimaryColor}} is the class representing the 
> enumeration {{(:Red, :Green, :Blue)}} , then a query of the form {{?x 
> rdf:type :PrimaryColor}} should be rewritten to find bindings {{:Red}} , 
> {{:Green}} , and {{:Blue}} for {{?x}}.



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


[GitHub] incubator-rya issue #206: RYA-292 Added owl:intersectionOf inference.

2017-08-15 Thread asfgit
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/392/



---
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

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

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

ASF GitHub Bot commented on RYA-292:


GitHub user ejwhite922 opened a pull request:

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

RYA-292 Added owl:intersectionOf inference.

## Description
Inference applies owl:intersectionOf semantics for queries including 
statement patterns of the form "?x rdf:type :DefinedClass".

The owl:intersectionOf property links a class to a list of class 
descriptions. An owl:intersectionOf statement describes a class for which the 
class extension contains precisely those individuals that are members of the 
class extension of all class descriptions in the list. 

The InferenceEngine, at refresh time, stores information about 
owl:intersectionOf. It stores a mapping of each type that has an intersection 
to its list of intersection sets (since each type can have multiple 
intersections) These mapped definitions can then be accessed by the method: 
getIntersectionsImplying(Resource).  Also, :A owl:intersectionOf(:B, :C) 
implies that :A subClassOf :B and :A subClassOf :C so members of the 
intersection are added to the subClassOf graph.

IntersectionOfVisitor processes statement patterns of the form "?x rdf:type 
:T2", and if :T2 is the value type for any owl:intersectionOf restriction 
according to the inference engine, it replaces the statement pattern with a 
union: of 1) that same statement pattern (in case the type is explicitly 
asserted or can be inferred by some other rule); and 2) a nested join tree of 
all the combined intersections for that type.

RdfCloudTripleStoreConnection calls the visitor along with the other 
inference logic. Because the original statement pattern is preserved as one 
branch of the union, other visitors can still apply if there are other ways to 
derive the type.

Added a simple example of a query that relies on this inference to 
MongoRyaDirectExample.

### Tests
Unit tests

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

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

 People To Review
@jessehatfield 
@meiercaleb 
@isper3at 
@pujav65 


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

$ git pull https://github.com/ejwhite922/incubator-rya 
RYA-292_IntersectionOfInference

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

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


commit f1d90f7f2e8d073fe3457f2dec89eec9675abe73
Author: eric.white 
Date:   2017-08-02T21:52:10Z

RYA-292 Added owl:intersectionOf inference.




> 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-250) Smart URI avoid data duplication

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

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

ASF GitHub Bot commented on RYA-250:


Github user asfgit commented on the issue:

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

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/391/



> Smart URI avoid data duplication
> 
>
> Key: RYA-250
> URL: https://issues.apache.org/jira/browse/RYA-250
> Project: Rya
>  Issue Type: Task
>  Components: dao
>Affects Versions: 3.2.10
>Reporter: Eric White
>Assignee: Eric White
> Fix For: 3.2.10
>
>
> Implement Smart URI methods for avoiding data duplication.



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


[GitHub] incubator-rya issue #153: RYA-250 Smart URI avoiding data duplication

2017-08-15 Thread asfgit
Github user asfgit commented on the issue:

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

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/391/



---
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.
---