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

    https://github.com/apache/incubator-rya/pull/174#discussion_r126982926
  
    --- Diff: 
sail/src/main/java/org/apache/rya/rdftriplestore/inference/HasValueVisitor.java 
---
    @@ -0,0 +1,96 @@
    +package org.apache.rya.rdftriplestore.inference;
    +/*
    + * 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.
    + */
    +
    +import java.util.Map;
    +import java.util.Set;
    +import java.util.UUID;
    +
    +import org.apache.rya.api.RdfCloudTripleStoreConfiguration;
    +import org.apache.rya.api.utils.NullableStatementImpl;
    +import org.apache.rya.rdftriplestore.utils.FixedStatementPattern;
    +import org.openrdf.model.Resource;
    +import org.openrdf.model.URI;
    +import org.openrdf.model.Value;
    +import org.openrdf.model.vocabulary.OWL;
    +import org.openrdf.model.vocabulary.RDF;
    +import org.openrdf.query.algebra.StatementPattern;
    +import org.openrdf.query.algebra.TupleExpr;
    +import org.openrdf.query.algebra.Var;
    +
    +public class HasValueVisitor extends AbstractInferVisitor {
    +    public HasValueVisitor(RdfCloudTripleStoreConfiguration conf, 
InferenceEngine inferenceEngine) {
    +        super(conf, inferenceEngine);
    +        include = true;
    +    }
    +
    +    @Override
    +    protected void meetSP(StatementPattern node) throws Exception {
    +        final Var subjVar = node.getSubjectVar();
    +        final Var predVar = node.getPredicateVar();
    +        final Var objVar = node.getObjectVar();
    +        // We can reason over two types of statement patterns:
    +        // { ?var rdf:type :Restriction } and { ?var :property ?value }
    +        // Both require defined predicate
    +        if (predVar != null && predVar.getValue() != null) {
    +            final URI predURI = (URI) predVar.getValue();
    +            if (RDF.TYPE.equals(predURI) && objVar != null && 
objVar.getValue() != null
    +                    && objVar.getValue() instanceof Resource) {
    +                // If the predicate is rdf:type and the type is specified, 
check whether it can be
    +                // inferred using any hasValue restriction(s)
    +                final Resource objType = (Resource) objVar.getValue();
    +                final Map<URI, Set<Value>> sufficientValues = 
inferenceEngine.getHasValueByType(objType);
    +                if (sufficientValues.size() > 0) {
    +                    final Var valueVar = new Var("v-" + UUID.randomUUID());
    +                    TupleExpr currentNode = node.clone();
    +                    for (URI property : sufficientValues.keySet()) {
    +                        final Var propVar = new Var(property.toString(), 
property);
    +                        final TupleExpr valueSP = new 
DoNotExpandSP(subjVar, propVar, valueVar);
    +                        final FixedStatementPattern relevantValues = new 
FixedStatementPattern(objVar, propVar, valueVar);
    --- End diff --
    
    So we require that both the parent and child class have the same value for 
each property returned by the inference engine?


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