org.eclipse.rdf4j.query.algebra.evaluation.TripleSource Java Examples
The following examples show how to use
org.eclipse.rdf4j.query.algebra.evaluation.TripleSource.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SpinParser.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
public Map<IRI, Argument> parseArguments(final IRI moduleUri, final TripleSource store) throws RDF4JException { try { return argumentCache.get(moduleUri, () -> { Map<IRI, Argument> args = new HashMap<>(); parseArguments(moduleUri, store, args); return Collections.unmodifiableMap(args); }); } catch (ExecutionException e) { if (e.getCause() instanceof RDF4JException) { throw (RDF4JException) e.getCause(); } else if (e.getCause() instanceof RuntimeException) { throw (RuntimeException) e.getCause(); } else { throw new RuntimeException(e); } } }
Example #2
Source File: ZeroLengthPathIterationTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Before public void setUp() { Model m = new LinkedHashModel(); m.add(RDF.ALT, RDF.TYPE, RDFS.CLASS); m.add(RDF.BAG, RDF.TYPE, RDFS.CLASS); TripleSource ts = new TripleSource() { @Override public CloseableIteration<? extends Statement, QueryEvaluationException> getStatements(Resource subj, IRI pred, Value obj, Resource... contexts) throws QueryEvaluationException { return new CloseableIteratorIteration<>(m.getStatements(subj, pred, obj, contexts).iterator()); } @Override public ValueFactory getValueFactory() { return vf; } }; evaluator = new StrictEvaluationStrategy(ts, null); }
Example #3
Source File: SpinParser.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
private void parseArguments(IRI moduleUri, TripleSource store, Map<IRI, Argument> args) throws RDF4JException { try (CloseableIteration<Resource, QueryEvaluationException> argIter = TripleSources .getObjectResources(moduleUri, SPIN.CONSTRAINT_PROPERTY, store)) { while (argIter.hasNext()) { Resource possibleArg = argIter.next(); Statement argTmpl = TripleSources.single(possibleArg, RDF.TYPE, SPL.ARGUMENT_TEMPLATE, store); if (argTmpl != null) { Value argPred = TripleSources.singleValue(possibleArg, SPL.PREDICATE_PROPERTY, store); Value valueType = TripleSources.singleValue(possibleArg, SPL.VALUE_TYPE_PROPERTY, store); boolean optional = TripleSources.booleanValue(possibleArg, SPL.OPTIONAL_PROPERTY, store); Value defaultValue = TripleSources.singleValue(possibleArg, SPL.DEFAULT_VALUE_PROPERTY, store); IRI argUri = (IRI) argPred; args.put(argUri, new Argument(argUri, (IRI) valueType, optional, defaultValue)); } } } }
Example #4
Source File: TripleSources.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * Returns the single statement with the given subject, predicate and object or null if none exists. Context * information is disregarded. * * @param subj null for any. * @param pred null for any. * @param obj null for any. * @throws QueryEvaluationException If there is more than one such statement. */ public static Statement single(Resource subj, IRI pred, Value obj, TripleSource store) throws QueryEvaluationException { Statement stmt; try (CloseableIteration<? extends Statement, QueryEvaluationException> stmts = store.getStatements(subj, pred, obj)) { if (stmts.hasNext()) { stmt = stmts.next(); while (stmts.hasNext()) { Statement nextStmt = stmts.next(); if (!org.eclipse.rdf4j.model.util.Statements.isSameTriple(stmt, nextStmt)) { throw new QueryEvaluationException( "Multiple statements for pattern: " + subj + " " + pred + " " + obj); } } } else { stmt = null; } } return stmt; }
Example #5
Source File: SpinParser.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
public ConstraintViolation parseConstraintViolation(Resource subj, TripleSource store) throws RDF4JException { Value labelValue = TripleSources.singleValue(subj, RDFS.LABEL, store); Value rootValue = TripleSources.singleValue(subj, SPIN.VIOLATION_ROOT_PROPERTY, store); Value pathValue = TripleSources.singleValue(subj, SPIN.VIOLATION_PATH_PROPERTY, store); Value valueValue = TripleSources.singleValue(subj, SPIN.VIOLATION_VALUE_PROPERTY, store); Value levelValue = TripleSources.singleValue(subj, SPIN.VIOLATION_LEVEL_PROPERTY, store); String label = (labelValue instanceof Literal) ? labelValue.stringValue() : null; String root = (rootValue instanceof Resource) ? rootValue.stringValue() : null; String path = (pathValue != null) ? pathValue.stringValue() : null; String value = (valueValue != null) ? valueValue.stringValue() : null; ConstraintViolationLevel level = ConstraintViolationLevel.ERROR; if (levelValue != null) { if (levelValue instanceof IRI) { level = ConstraintViolationLevel.valueOf((IRI) levelValue); } if (level == null) { throw new MalformedSpinException( "Invalid value " + levelValue + " for " + SPIN.VIOLATION_LEVEL_PROPERTY + ": " + subj); } } return new ConstraintViolation(label, root, path, value, level); }
Example #6
Source File: SpinParser.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
public Map<IRI, RuleProperty> parseRuleProperties(TripleSource store) throws RDF4JException { Map<IRI, RuleProperty> rules = new HashMap<>(); try (CloseableIteration<IRI, QueryEvaluationException> rulePropIter = TripleSources .getSubjectURIs(RDFS.SUBPROPERTYOF, SPIN.RULE_PROPERTY, store)) { while (rulePropIter.hasNext()) { IRI ruleProp = rulePropIter.next(); RuleProperty ruleProperty = new RuleProperty(ruleProp); List<IRI> nextRules = getNextRules(ruleProp, store); ruleProperty.setNextRules(nextRules); int maxIterCount = getMaxIterationCount(ruleProp, store); ruleProperty.setMaxIterationCount(maxIterCount); rules.put(ruleProp, ruleProperty); } } return rules; }
Example #7
Source File: SpinParser.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 6 votes |
private int getMaxIterationCount(Resource ruleProp, TripleSource store) throws RDF4JException { Value v = TripleSources.singleValue(ruleProp, SPIN.RULE_PROPERTY_MAX_ITERATION_COUNT_PROPERTY, store); if (v == null) { return -1; } else if (v instanceof Literal) { try { return ((Literal) v).intValue(); } catch (NumberFormatException e) { throw new MalformedSpinException("Value for " + SPIN.RULE_PROPERTY_MAX_ITERATION_COUNT_PROPERTY + " must be of datatype " + XMLSchema.INTEGER + ": " + ruleProp); } } else { throw new MalformedSpinException( "Non-literal value for " + SPIN.RULE_PROPERTY_MAX_ITERATION_COUNT_PROPERTY + ": " + ruleProp); } }
Example #8
Source File: StrictEvaluationStrategyFactory.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public EvaluationStrategy createEvaluationStrategy(Dataset dataset, TripleSource tripleSource, EvaluationStatistics evaluationStatistics) { StrictEvaluationStrategy strategy = new StrictEvaluationStrategy(tripleSource, dataset, serviceResolver, getQuerySolutionCacheThreshold(), evaluationStatistics, isTrackResultSize()); getOptimizerPipeline().ifPresent(strategy::setOptimizerPipeline); return strategy; }
Example #9
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsTwoContextsPredicateExClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"))) { List<Statement> list = Iterations.asList(statements); assertEquals(6, list.size()); } }
Example #10
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsThreeContextsOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob, this.mary); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, null, null, this.alice)) { List<Statement> list = Iterations.asList(statements); assertEquals(8, list.size()); } }
Example #11
Source File: SailSourceEvaluationStrategyFactory.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Override public EvaluationStrategy createEvaluationStrategy(Dataset dataset, TripleSource tripleSource, EvaluationStatistics evaluationStatistics) { EvaluationStrategy delegateStrategy = delegate.createEvaluationStrategy(dataset, tripleSource, evaluationStatistics); return new SailSourceEvaluationStrategy(delegateStrategy, dataset); }
Example #12
Source File: SpinMagicPropertyInterpreter.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
public SpinMagicPropertyInterpreter(SpinParser parser, TripleSource tripleSource, TupleFunctionRegistry tupleFunctionRegistry, AbstractFederatedServiceResolver serviceResolver) { this.parser = parser; this.tripleSource = tripleSource; this.tupleFunctionRegistry = tupleFunctionRegistry; this.serviceResolver = serviceResolver; this.spinServiceUri = tripleSource.getValueFactory().createIRI(SPIN_SERVICE); }
Example #13
Source File: SpinInferencing.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
private static void addBindings(Resource subj, Resource opResource, ParsedOperation parsedOp, Operation op, TripleSource tripleSource, SpinParser parser) throws OpenRDFException { if (!parser.isThisUnbound(opResource, tripleSource)) { op.setBinding(THIS_VAR, subj); } if (parsedOp instanceof ParsedTemplate) { for (Binding b : ((ParsedTemplate) parsedOp).getBindings()) { op.setBinding(b.getName(), b.getValue()); } } }
Example #14
Source File: SpinInferencing.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static int executeRule(Resource subj, Resource rule, QueryPreparer queryPreparer, SpinParser parser, InferencerConnection conn) throws OpenRDFException { int nofInferred; TripleSource tripleSource = queryPreparer.getTripleSource(); ParsedOperation parsedOp = parser.parse(rule, tripleSource); if (parsedOp instanceof ParsedGraphQuery) { ParsedGraphQuery graphQuery = (ParsedGraphQuery) parsedOp; GraphQuery queryOp = queryPreparer.prepare(graphQuery); addBindings(subj, rule, graphQuery, queryOp, tripleSource, parser); CountingRDFInferencerInserter handler = new CountingRDFInferencerInserter(conn, tripleSource.getValueFactory()); queryOp.evaluate(handler); nofInferred = handler.getStatementCount(); } else if (parsedOp instanceof ParsedUpdate) { ParsedUpdate graphUpdate = (ParsedUpdate) parsedOp; Update updateOp = queryPreparer.prepare(graphUpdate); addBindings(subj, rule, graphUpdate, updateOp, tripleSource, parser); UpdateCountListener listener = new UpdateCountListener(); conn.addConnectionListener(listener); updateOp.execute(); conn.removeConnectionListener(listener); // number of statement changes nofInferred = listener.getAddedStatementCount() + listener.getRemovedStatementCount(); } else { throw new MalformedSpinException("Invalid rule: " + rule); } return nofInferred; }
Example #15
Source File: CanInvoke.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
private Function getFunction(String name, TripleSource tripleSource, FunctionRegistry functionRegistry) throws RDF4JException { Function func = functionRegistry.get(name).orElse(null); if (func == null) { IRI funcUri = tripleSource.getValueFactory().createIRI(name); func = parser.parseFunction(funcUri, tripleSource); functionRegistry.add(func); } return func; }
Example #16
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsThreeContextsThreeContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob, this.mary); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, null, null, this.alice, this.bob, this.mary)) { List<Statement> list = Iterations.asList(statements); assertEquals(24, list.size()); } }
Example #17
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsThreeContextsTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob, this.mary); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, null, null, this.alice, this.bob)) { List<Statement> list = Iterations.asList(statements); assertEquals(16, list.size()); } }
Example #18
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsTwoContextsPredicateExClassOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"), this.alice)) { List<Statement> list = Iterations.asList(statements); assertEquals(3, list.size()); } }
Example #19
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsOneContextPredicateExClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"))) { List<Statement> list = Iterations.asList(statements); assertEquals(3, list.size()); } }
Example #20
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsNoContextsPredicateExClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, f.createIRI(EX_NS, "A"))) { List<Statement> list = Iterations.asList(statements); assertEquals(3, list.size()); } }
Example #21
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsTwoContextsPredicateOwlClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDF.TYPE, OWL.CLASS)) { List<Statement> list = Iterations.asList(statements); assertEquals(8, list.size()); } }
Example #22
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsNoContextsPredicateOwlClassNoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDF.TYPE, OWL.CLASS)) { List<Statement> list = Iterations.asList(statements); assertEquals(4, list.size()); } }
Example #23
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsOneContextPredicateOwlClassTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDF.TYPE, OWL.CLASS, this.alice, this.bob)) { List<Statement> list = Iterations.asList(statements); assertEquals(4, list.size()); } }
Example #24
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsNoContextsPredicateOwlClassTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDF.TYPE, OWL.CLASS, this.alice, this.bob)) { List<Statement> list = Iterations.asList(statements); assertEquals(0, list.size()); } }
Example #25
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsNoContextsPredicateOwlThingTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, OWL.THING, this.alice, this.bob)) { List<Statement> list = Iterations.asList(statements); assertEquals(0, list.size()); } }
Example #26
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsTwoContextsOnePredicateTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, null, this.alice, this.bob)) { List<Statement> list = Iterations.asList(statements); assertEquals(8, list.size()); } }
Example #27
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsOneContextOnePredicateTwoContexts() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, null, this.alice, this.bob)) { List<Statement> list = Iterations.asList(statements); assertEquals(4, list.size()); } }
Example #28
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsTwoContextsOnePredicateOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice, this.bob); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, null, this.alice)) { List<Statement> list = Iterations.asList(statements); assertEquals(4, list.size()); } }
Example #29
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsOneContextOnePredicateOneContext() throws Exception { loadTestData("/alp-testdata.ttl", this.alice); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, null, this.alice)) { List<Statement> list = Iterations.asList(statements); assertEquals(4, list.size()); } }
Example #30
Source File: MemTripleSourceTest.java From rdf4j with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * Test method for * {@link org.eclipse.rdf4j.sail.memory.MemTripleSource#getStatements(org.eclipse.rdf4j.model.Resource, org.eclipse.rdf4j.model.IRI, org.eclipse.rdf4j.model.Value, org.eclipse.rdf4j.model.Resource[])} * . */ @Test public final void testGetStatementsNoContextsOnePredicateOneContext() throws Exception { loadTestData("/alp-testdata.ttl"); TripleSource source = getTripleSourceCommitted(); try (CloseableIteration<? extends Statement, QueryEvaluationException> statements = source.getStatements(null, RDFS.SUBCLASSOF, null, this.alice)) { List<Statement> list = Iterations.asList(statements); assertEquals(0, list.size()); } }