use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestNode method testCreatePrefixed.
public void testCreatePrefixed() {
PrefixMapping pm = PrefixMapping.Factory.create();
/* TODO Node n = */
NodeCreateUtils.create(pm, "xyz");
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestNode method testCreateURIOtherMap.
public void testCreateURIOtherMap() {
String myNS = "eh:foo/bar#", suffix = "something";
PrefixMapping mine = PrefixMapping.Factory.create().setNsPrefix("mine", myNS);
Node n = NodeCreateUtils.create(mine, "mine:" + suffix);
assertEquals(myNS + suffix, n.getURI());
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestNode method testToStringWithPrefixMapping.
public void testToStringWithPrefixMapping() {
PrefixMapping pm = PrefixMapping.Factory.create();
String prefix = "spoo", ns = "abc:def/ghi#";
pm.setNsPrefix(prefix, ns);
String suffix = "bamboozle";
assertEquals(prefix + ":" + suffix, NodeCreateUtils.create(ns + suffix).toString(pm));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class TestTriple method testTripleToStringWithPrefixing.
public void testTripleToStringWithPrefixing() {
PrefixMapping pm = PrefixMapping.Factory.create();
pm.setNsPrefix("spoo", "eg://domain.dom/spoo#");
Triple t1 = NodeCreateUtils.createTriple("eg://domain.dom/spoo#a b c");
assertEquals("spoo:a @eh:/b eh:/c", t1.toString(pm));
}
use of org.apache.jena.shared.PrefixMapping in project jena by apache.
the class WhereClauseTest method testAddOptionalTriplePath.
@ContractTest
public void testAddOptionalTriplePath() {
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(new TriplePath(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);
}
Aggregations