Examples of TripleSource


Examples of com.clarkparsia.empire.ds.TripleSource

        Map<String, Object> aMap = Maps.newHashMap();
        aMap.put("factory", "sesame");

        DataSource aSesameSource = Empire.get().persistenceProvider().createDataSource("test-sesame", aMap);

        TripleSource aTripleSrc = DataSourceUtil.asTripleSource(aSesameSource);

        // Sesame sources are triple sources
        assertTrue(aSesameSource == aTripleSrc);
    }
View Full Code Here

Examples of com.clarkparsia.empire.ds.TripleSource

  public void testDuplicate() throws Exception {
    EntityManager em = createEntityManager();

    assumeTrue(em.getDelegate() instanceof TripleSource);

    TripleSource aSource = (TripleSource) em.getDelegate();

    EntityTest aObj = InstanceGenerator.generateInstanceClass(EntityTest.class).newInstance();
    aObj.setId("someid");
    aObj.setLabel("some label");

    em.persist(aObj);

    aObj.setLabel("foo");

    em.merge(aObj);

    Graph aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));

    assertEquals(3, aGraph.size());
    assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());

    em.remove(aObj);

    ParentEntity pe = InstanceGenerator.generateInstanceClass(ParentEntity.class).newInstance();
    pe.setEntity(aObj);

    em.persist(pe);

    aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));

    assertEquals(5, aGraph.size());
    assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());

    aObj.setLabel("foobarbaz");

    em.merge(pe);

    aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));

    assertEquals(5, aGraph.size());
    assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());
  }
View Full Code Here

Examples of com.clarkparsia.empire.ds.TripleSource

  public void testDuplicate2() throws Exception {
    EntityManager em = createEntityManager();

    assumeTrue(em.getDelegate() instanceof TripleSource);
   
    TripleSource aSource = (TripleSource) em.getDelegate();

    EntityTest aObj = InstanceGenerator.generateInstanceClass(EntityTest.class).newInstance();
    aObj.setId("someid");
    aObj.setLabel("some label");

    em.persist(aObj);

    em.refresh(aObj);

    aObj.setLabel("foo");

    em.merge(aObj);

    Graph aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));

    assertEquals(3, aGraph.size());
    assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());

    em.remove(aObj);

    ParentEntity pe = InstanceGenerator.generateInstanceClass(ParentEntity.class).newInstance();
    pe.setEntity(aObj);

    em.persist(pe);

    em.refresh(pe);

    aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));

    assertEquals(5, aGraph.size());
    assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());

    aObj.setLabel("foobarbaz");

    em.merge(pe);

    aGraph = Graphs.newGraph(aSource.getStatements(null, null, null));

    assertEquals(5, aGraph.size());
    assertEquals(1, Lists.newArrayList(aGraph.match(null, ValueFactoryImpl.getInstance().createURI("urn:label"), null)).size());
  }
View Full Code Here

Examples of com.clarkparsia.empire.ds.TripleSource

    // this is a test source, so it should not be a TripleSource...

    assertFalse(aTestSource instanceof TripleSource);

    TripleSource aTripleSrc = DataSourceUtil.asTripleSource(aTestSource);

    assertTrue(aTestSource != aTripleSrc);
  }
View Full Code Here

Examples of org.openrdf.query.algebra.evaluation.TripleSource

      if (!isAutoCommit()) {
        snapshot++;
        readMode = ReadMode.TRANSACTION;
      }

      TripleSource tripleSource = new MemTripleSource(includeInferred, snapshot, readMode);
      EvaluationStrategyImpl strategy = new EvaluationStrategyImpl(tripleSource, query);

      QueryOptimizerList optimizerList = new QueryOptimizerList();
      optimizerList.add(new BindingAssigner());
      optimizerList.add(new ConstantOptimizer(strategy));
View Full Code Here

Examples of org.openrdf.query.algebra.evaluation.TripleSource

  }

  public Cursor<? extends BindingSet> evaluate(QueryModel query, BindingSet bindings, boolean includeInferred)
    throws StoreException
  {
    TripleSource tripleSource = new FederationTripleSource(includeInferred);
    EvaluationStrategyImpl strategy = new FederationStrategy(federation.getExecutor(), tripleSource, query, includeInferred);
    query = optimize(query, bindings, strategy);
    return strategy.evaluate(query, EmptyBindingSet.getInstance());
  }
View Full Code Here

Examples of org.openrdf.query.algebra.evaluation.TripleSource

    Cursor<BindingSet> result = expr.evaluate(dataset, bindings, includeInferred);
    if (result != null) {
      return result;
    }
    QueryModel query = createQueryModel(expr);
    TripleSource source = new RepositoryTripleSource(expr.getOwner());
    EvaluationStrategyImpl eval = new FederationStrategy(executor, source, query, includeInferred);
    return eval.evaluate(query, bindings);
  }
View Full Code Here

Examples of org.openrdf.query.algebra.evaluation.TripleSource

    protected CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluateInternal(final TupleExpr query,
                                                                                                  final Dataset dataset,
                                                                                                  final BindingSet bindings,
                                                                                                  final boolean includeInferred) throws SailException {
        try {
            TripleSource tripleSource = new SailConnectionTripleSource(this, context.valueFactory, includeInferred);
            EvaluationStrategyImpl strategy = new EvaluationStrategyImpl(tripleSource, dataset);
            return strategy.evaluate(query, bindings);
        } catch (QueryEvaluationException e) {
            throw new SailException(e);
        }
View Full Code Here

Examples of org.openrdf.query.algebra.evaluation.TripleSource

    public CloseableIteration<? extends BindingSet, QueryEvaluationException> evaluateInternal(TupleExpr tupleExpr,
                                                                                               final Dataset dataset,
                                                                                               final BindingSet bindings,
                                                                                               final boolean includeInferred) throws SailException {
        try {
            TripleSource tripleSource = new SailConnectionTripleSource(this, store.valueFactory, includeInferred);
            EvaluationStrategyImpl strategy = new EvaluationStrategyImpl(tripleSource, dataset);
            return strategy.evaluate(tupleExpr, bindings);
        } catch (QueryEvaluationException e) {
            throw new SailException(e);
        }
View Full Code Here

Examples of org.openrdf.query.algebra.evaluation.TripleSource

      if (transactionActive()) {
        snapshot++;
        readMode = ReadMode.TRANSACTION;
      }

      TripleSource tripleSource = new MemTripleSource(includeInferred, snapshot, readMode);
      EvaluationStrategyImpl strategy = new EvaluationStrategyImpl(tripleSource, dataset);

      QueryOptimizerList optimizerList = new QueryOptimizerList();
      optimizerList.add(new BindingAssigner());
      optimizerList.add(new ConstantOptimizer(strategy));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.