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<URI,URI> propertyChainPropertiesToBNodes = new 
HashMap<URI, URI>();
    -            propertyChainPropertyToChain = new HashMap<URI, List<URI>>();
    +
    +            final ValueFactory vf = ValueFactoryImpl.getInstance();
    +            iter = RyaDAOHelper.query(ryaDAO, null,
    +                    
vf.createURI("http://www.w3.org/2002/07/owl#propertyChainAxiom";),
    +                    null, conf);
    +            final Map<URI,URI> 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<Integer, URI> orderedProperties = new 
TreeMap<Integer, URI>();
    -                   // 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<Statement, 
QueryEvaluationException>  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();
    -                                             break;
    -                                     }
    -                                     iter2.close();
    -                                     }
    -                             }
    -                             if (!integerValue.isEmpty() && propURI!=null) 
{
    -                                     try {
    -                                     int indexValue = 
Integer.parseInt(integerValue);
    -                                     URI chainPropURI = 
vf.createURI(propURI.stringValue());
    -                                     orderedProperties.put(indexValue, 
chainPropURI);
    -                                     }
    -                                     catch (Exception ex){
    -                                             // TODO log an error here
    -                                             
    -                                     }
    -                             }
    -                           }
    -                   } finally{
    -                           if (iter != null){
    -                                   iter.close();
    -                           }
    -                   }
    -                   List<URI> properties = new ArrayList<URI>();
    -                   for (Map.Entry<Integer, URI> entry : 
orderedProperties.entrySet()){
    -                           properties.add(entry.getValue());
    -                   }
    -                   propertyChainPropertyToChain.put(propertyChainProperty, 
properties);
    +            for (final URI propertyChainProperty : 
propertyChainPropertiesToBNodes.keySet()){
    +                final 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);
    +                final TreeMap<Integer, URI> orderedProperties = new 
TreeMap<Integer, URI>();
    +                // TODO refactor this.  Wish I could execute sparql
    +                try {
    +                    while (iter.hasNext()){
    +                      final Statement st = iter.next();
    --- End diff --
    
    This block is still slightly offset


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

Reply via email to