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

    https://github.com/apache/incubator-rya/pull/197#discussion_r132463450
  
    --- Diff: 
sail/src/test/java/org/apache/rya/rdftriplestore/inference/DomainRangeVisitorTest.java
 ---
    @@ -0,0 +1,140 @@
    +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 static org.mockito.Mockito.mock;
    +import static org.mockito.Mockito.when;
    +
    +import java.util.HashSet;
    +import java.util.Set;
    +import java.util.Stack;
    +
    +import org.apache.rya.accumulo.AccumuloRdfConfiguration;
    +import org.apache.rya.rdftriplestore.utils.FixedStatementPattern;
    +import org.junit.Assert;
    +import org.junit.Test;
    +import org.openrdf.model.Resource;
    +import org.openrdf.model.Statement;
    +import org.openrdf.model.URI;
    +import org.openrdf.model.ValueFactory;
    +import org.openrdf.model.impl.ValueFactoryImpl;
    +import org.openrdf.model.vocabulary.RDF;
    +import org.openrdf.model.vocabulary.RDFS;
    +import org.openrdf.query.algebra.Join;
    +import org.openrdf.query.algebra.Projection;
    +import org.openrdf.query.algebra.ProjectionElem;
    +import org.openrdf.query.algebra.ProjectionElemList;
    +import org.openrdf.query.algebra.StatementPattern;
    +import org.openrdf.query.algebra.TupleExpr;
    +import org.openrdf.query.algebra.Union;
    +import org.openrdf.query.algebra.Var;
    +
    +public class DomainRangeVisitorTest {
    +    private final AccumuloRdfConfiguration conf = new 
AccumuloRdfConfiguration();
    +    private final ValueFactory vf = new ValueFactoryImpl();
    +    private final URI person = vf.createURI("lubm:Person");
    +    private final URI advisor = vf.createURI("lubm:advisor");
    +    private final URI takesCourse = vf.createURI("lubm:takesCourse");
    +
    +    @Test
    +    public void testRewriteTypePattern() throws Exception {
    +        final InferenceEngine inferenceEngine = 
mock(InferenceEngine.class);
    +        final Set<URI> domainPredicates = new HashSet<>();
    +        final Set<URI> rangePredicates = new HashSet<>();
    +        domainPredicates.add(advisor);
    +        domainPredicates.add(takesCourse);
    +        rangePredicates.add(advisor);
    +        
when(inferenceEngine.getPropertiesWithDomain(person)).thenReturn(domainPredicates);
    +        
when(inferenceEngine.getPropertiesWithRange(person)).thenReturn(rangePredicates);
    +        final Var subjVar = new Var("s");
    +        final StatementPattern originalSP = new StatementPattern(subjVar, 
new Var("p", RDF.TYPE), new Var("o", person));
    +        final Projection query = new Projection(originalSP, new 
ProjectionElemList(new ProjectionElem("s", "subject")));
    +        new DomainRangeVisitor(conf, inferenceEngine).meet(query);
    --- End diff --
    
    Should this be query.visit(new DomainRangeVisitor(conf, inferenceEngine))?  
Or does it not matter?


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