use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class WhereClauseTest method testAddOptionalObjectsWithPath.
@ContractTest
public void testAddOptionalObjectsWithPath() {
WhereClause<?> whereClause = getProducer().newInstance();
PrefixMapping pmap = new PrefixMappingImpl();
pmap.setNsPrefix("ts", "urn:test:");
Path path = PathParser.parse("ts:two/ts:dos", pmap);
AbstractQueryBuilder<?> builder = whereClause.addOptional(NodeFactory.createURI("one"), path, NodeFactory.createURI("three"));
ElementPathBlock epb = new ElementPathBlock();
ElementOptional optional = new ElementOptional(epb);
TriplePath tp = new TriplePath(NodeFactory.createURI("one"), path, NodeFactory.createURI("three"));
epb.addTriplePath(tp);
WhereValidator visitor = new WhereValidator(optional);
builder.build().getQueryPattern().visit(visitor);
assertTrue(visitor.matching);
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class PrologClauseTest method testAddPrefixNode.
@ContractTest
public void testAddPrefixNode() {
PrologClause<?> prologClause = getProducer().newInstance();
AbstractQueryBuilder<?> builder = prologClause.addPrefix("pfx", NodeFactory.createURI("uri"));
Query q = builder.build();
PrefixMapping map = q.getPrefixMapping();
assertEquals("uri", map.getNsPrefixURI("pfx"));
assertEquals(1, map.getNsPrefixMap().size());
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class PrologClauseTest method testAddPrefixString.
@ContractTest
public void testAddPrefixString() {
PrologClause<?> prologClause = getProducer().newInstance();
AbstractQueryBuilder<?> builder = prologClause.addPrefix("pfx", "uri");
Query q = builder.build();
PrefixMapping map = q.getPrefixMapping();
assertEquals("uri", map.getNsPrefixURI("pfx"));
assertEquals(1, map.getNsPrefixMap().size());
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class PrologClauseTest method testAddPrefixResource.
@ContractTest
public void testAddPrefixResource() {
PrologClause<?> prologClause = getProducer().newInstance();
AbstractQueryBuilder<?> builder = prologClause.addPrefix("pfx", ResourceFactory.createResource("uri"));
Query q = builder.build();
PrefixMapping map = q.getPrefixMapping();
assertEquals("uri", map.getNsPrefixURI("pfx"));
assertEquals(1, map.getNsPrefixMap().size());
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class FusekiNetLib method addDataInto.
public static void addDataInto(DatasetGraph src, DatasetGraph dest) {
Iterator<Quad> iter = src.find(Node.ANY, Node.ANY, Node.ANY, Node.ANY);
for (; iter.hasNext(); ) {
Quad q = iter.next();
dest.add(q);
}
PrefixMapping pmapSrc = src.getDefaultGraph().getPrefixMapping();
PrefixMapping pmapDest = dest.getDefaultGraph().getPrefixMapping();
pmapDest.withDefaultMappings(pmapSrc);
}
Aggregations