Github user ejwhite922 commented on a diff in the pull request:
https://github.com/apache/incubator-rya/pull/217#discussion_r135034229
--- Diff:
sail/src/main/java/org/apache/rya/rdftriplestore/inference/InferenceEngine.java
---
@@ -1220,6 +1266,71 @@ public void setSchedule(final boolean schedule) {
}
/**
+ * Given some schema mapping types to (type, property) pairs that
somehow imply the key type,
+ * and given a particular type being queried for, expand the
combinations of types and
+ * properties that can imply the query type by including any pairs
that could imply subtypes of
+ * the query type (using the subclass graph), and by expanding each
property into a set of all
+ * subproperties that imply it (using the subproperty graph). Does not
consider subtypes of
+ * potential triggering types.
+ * @param queryType The type whose possible derivations are needed
+ * @param schemaMap Map of schema information such that each key
represents a type that can
+ * somehow be derived from (other type x property) combinations,
and the value provides
+ * those combinations that can be used for the implication.
+ * @return Combinations of types and properties that can directly or
indirectly imply the query
+ * type according to the schema provided and the
subclass/superproperty graphs. Any
+ * individual type/property combination is sufficient.
+ */
+ private Map<Resource, Set<URI>> getTypePropertyImplyingType(final
Resource queryType, final Map<Resource, Map<Resource, URI>> schemaMap) {
+ final Map<Resource, Set<URI>> implications = new HashMap<>();
+ if (schemaMap != null) {
+ // Check for any subtypes which would in turn imply the type
being queried for
+ final HashSet<Resource> queryTypes = new HashSet<>();
+ queryTypes.add(queryType);
+ if (queryType instanceof URI) {
+ queryTypes.addAll(getSubClasses((URI) queryType));
+ }
+ for (final Resource querySubType : queryTypes) {
+ if (schemaMap.containsKey(querySubType)) {
+ final Map<Resource, URI> otherTypeToProperty =
schemaMap.get(querySubType);
+ for (final Resource otherType :
otherTypeToProperty.keySet()) {
+ if (!implications.containsKey(otherType)) {
+ implications.put(otherType, new HashSet<>());
+ }
+ final URI property =
otherTypeToProperty.get(otherType);
+ implications.get(otherType).add(property);
--- End diff --
Check that property isn't null before adding.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---