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

ASF GitHub Bot commented on RYA-292:
------------------------------------

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

    https://github.com/apache/incubator-rya/pull/206#discussion_r134589415
  
    --- Diff: 
sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java 
---
    @@ -723,29 +724,38 @@ public void handleStatement(final Statement 
statement) throws RDFHandlerExceptio
                         }
                     }
                 }
    -
    -            final List<Statement> typeStatements = new ArrayList<>();
    -            ryaDaoQueryWrapper.queryAll(type, OWL.INTERSECTIONOF, null, 
new RDFHandlerBase() {
    -                @Override
    -                public void handleStatement(final Statement statement) 
throws RDFHandlerException {
    -                    typeStatements.add(statement);
    -                }
    -            });
    +            for (final Set<Resource> intersection : intersectionList) {
    +                addIntersection(intersection, type);
    +            }
    +        }
    +        for (final Entry<Resource, List<Set<Resource>>> entry : 
intersectionsProp.entrySet()) {
    +            final Resource type = entry.getKey();
    +            final List<Set<Resource>> intersectionList = entry.getValue();
     
                 final Set<URI> superClasses = getSuperClasses((URI) type);
    +            for (final URI superClass : superClasses) {
    +                // Add intersections to super classes if applicable.
    +                // IF:
    +                // :A intersectionOf[:B, :C]
    +                // AND
    +                // :A subclassOf :D
    +                // Then we can infer:
    +                // intersectionOf[:B, :C] subclassOf :D
    +                for (final Set<Resource> intersection : intersectionList) {
    +                    addIntersection(intersection, superClass);
    +                }
    +            }
    +            // Check if other keys have any of the same intersections and 
infer
    +            // the same subclass logic to them that we know from the 
current
    +            // type. Propagating up through all the superclasses.
                 for (final Set<Resource> intersection : intersectionList) {
    -                addIntersection(intersection, type);
    -                for (final URI superClass : superClasses) {
    -                    // Add intersections to super classes if applicable.
    -                    // IF:
    -                    // :A intersectionOf[:B, :C]
    -                    // AND
    -                    // :A subclassOf :D
    -                    // Then we can infer:
    -                    // intersectionOf[:B, :C] subclassOf :D
    -                    for (final Statement statement : typeStatements) {
    -                        final Resource intersectionOfBnode = (Resource) 
statement.getObject();
    -                        addSubClassOf(intersectionOfBnode, superClass);
    +                final Set<Resource> otherKeys = 
Sets.newHashSet(intersectionsProp.keySet());
    +                otherKeys.remove(type);
    +                for (final Resource otherKey : otherKeys) {
    +                    if 
(intersectionsProp.get(otherKey).contains(intersection)) {
    +                        for (final URI superClass : superClasses) {
    --- End diff --
    
    I updated this. otherKey and type are now inferred to be equivalentClasses 
so this changed some of the unit test expected output.


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

Reply via email to