[ https://issues.apache.org/jira/browse/RYA-297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16100819#comment-16100819 ]
ASF GitHub Bot commented on RYA-297: ------------------------------------ GitHub user jessehatfield opened a pull request: https://github.com/apache/incubator-rya/pull/184 RYA-297 Added owl:equivalentClass inference If A and B are equivalent classes, then A is a subclass of B and B is a subclass of A. Handled the same way as owl:equivalentProperty. <!-- 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. --> ## Description Modified InferenceEngine to add equivalentClass information to the subclass graph. (Semantics: for two classes to be equivalent means that they represent the same set, while for one class to be a subclass of another means that it represents a subset. Therefore to say that two classes are equivalent is identical to saying that each is a subclass of the other.) Pulled the query logic into a helper function because the same basic pattern is used for subclass, subproperty, equivalent property, and now equivalent class relations. Because subClassOf inference is already supported, this means no new visitor is required. Slightly edited one line in SubClassOfVisitor to avoid adding the same subclass relation to the FixedStatementPattern twice, which would otherwise be possible: equivalent classes are mutual subclasses of each other, creating a cycle in the subclass graph. and allowing findParents to return a set containing the original node. Therefore, instead of always adding a statement corresponding to the original type, just add the original type to the set returned by findParents, which will do nothing if it was already included. This is identical to the logic in SubPropertyOfVisitor. ### Tests Added two tests to InferenceEngineTest, one for classes and one for properties, to verify that the inference engine builds the expected subclass/subproperty graph given an ontology involving sub- and equivalent- relations. Added a test to InferenceIT that inserts schema and instance data, then runs a query that depends on the application of subclass and equivalent class inference. ### Links [Jira](https://issues.apache.org/jira/browse/RYA-297) ### Checklist - [ ] Code Review - [ ] Squash Commits #### People To Reivew @meiercaleb You can merge this pull request into a Git repository by running: $ git pull https://github.com/jessehatfield/incubator-rya RYA-297-equivalentClass-inference Alternatively you can review and apply these changes as the patch at: https://github.com/apache/incubator-rya/pull/184.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 #184 ---- commit df49b04386c6e0ccb92757f31f1865c913eb85d3 Author: Jesse Hatfield <jesse.hatfi...@parsons.com> Date: 2017-07-25T21:08:31Z RYA-297 Added owl:equivalentClass inference If A and B are equivalent classes, then A is a subclass of B and B is a subclass of A. Handled the same way as owl:equivalentProperty. ---- > Implement owl:equivalentClass inference > --------------------------------------- > > Key: RYA-297 > URL: https://issues.apache.org/jira/browse/RYA-297 > Project: Rya > Issue Type: Sub-task > Components: sail > Reporter: Jesse Hatfield > Assignee: Jesse Hatfield > > An *{{owl:equivalentClass}}* statement is equivalent to stating that two > classes are each subclasses of the other. > The inference engine already supports subclass reasoning, but appears not to > check for equivalent class statements. This can likely be handled by adding > the relationship to the subclass graph in both directions, as seems to be > done for equivalent properties. -- This message was sent by Atlassian JIRA (v6.4.14#64029)