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

    https://github.com/apache/incubator-rya/pull/180#discussion_r132213500
  
    --- Diff: 
sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java 
---
    @@ -142,6 +143,53 @@ public void refreshGraph() throws 
InferenceEngineException {
                     }
                 }
     
    +            // Add unions to the subclass graph: if c owl:unionOf LIST(c1, 
c2, ... cn), then any
    +            // instances of c1, c2, ... or cn are also instances of c, 
meaning c is a superclass
    +            // of all the rest.
    +            // (In principle, an instance of c is likewise implied to be 
at least one of the other
    +            // types, but this fact is ignored for now to avoid 
nondeterministic reasoning.)
    +            iter = RyaDAOHelper.query(ryaDAO, null, OWL.UNIONOF, null, 
conf);
    +            try {
    +                while (iter.hasNext()) {
    +                    Statement st = iter.next();
    +                    Value unionType = st.getSubject();
    +                    // Traverse the list of types constituting the union
    +                    Value current = st.getObject();
    +                    while (current instanceof Resource && 
!RDF.NIL.equals(current)) {
    +                        Resource listNode = (Resource) current;
    +                        CloseableIteration<Statement, 
QueryEvaluationException> listIter = RyaDAOHelper.query(ryaDAO,
    +                                listNode, RDF.FIRST, null, conf);
    +                        try {
    +                            if (listIter.hasNext()) {
    +                                Statement firstStatement = listIter.next();
    +                                if (firstStatement.getObject() instanceof 
Resource) {
    +                                    Resource subclass = (Resource) 
firstStatement.getObject();
    +                                    Statement subclassStatement = 
vf.createStatement(subclass, RDFS.SUBCLASSOF, unionType);
    +                                    addStatementEdge(graph, 
RDFS.SUBCLASSOF.stringValue(), subclassStatement);
    +                                }
    +                            }
    +                        } finally {
    +                            listIter.close();
    +                        }
    +                        listIter = RyaDAOHelper.query(ryaDAO, listNode, 
RDF.REST, null, conf);
    +                        try {
    +                            if (listIter.hasNext()) {
    +                                current = listIter.next().getObject();
    --- End diff --
    
    Trying to follow the general logic here:  Each list has an RDF.FIRST and 
RDF.RESET property, where FIRST is a resource and REST is of type list.  So if 
the list has more than one element, current is set to the list obtained by the 
RDF.REST query and we go through the loop again.  Is this how all of the 
SUBCLASSOF statements are created for the union?


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