use of org.apache.jena.sparql.core.TriplePath in project jena by apache.
the class WhereHandlerTest method testAddWhereObjects.
@Test
public void testAddWhereObjects() {
handler.addWhere(new TriplePath(new Triple(NodeFactory.createURI("one"), ResourceFactory.createResource("two").asNode(), ResourceFactory.createLangLiteral("three", "en-US").asNode())));
assertContainsRegex(WHERE + OPEN_CURLY + uri("one") + SPACE + uri("two") + SPACE + quote("three") + "@en-US" + OPT_SPACE + CLOSE_CURLY, query.toString());
}
use of org.apache.jena.sparql.core.TriplePath in project jena by apache.
the class WhereHandlerTest method testAddAllPopulatedEmpty.
@Test
public void testAddAllPopulatedEmpty() {
handler.addWhere(new TriplePath(Triple.ANY));
Query query2 = new Query();
WhereHandler handler2 = new WhereHandler(query2);
handler2.addWhere(new TriplePath(new Triple(NodeFactory.createURI("one"), NodeFactory.createURI("two"), NodeFactory.createLiteral("three"))));
handler.addAll(handler2);
assertContainsRegex(WHERE + OPEN_CURLY + "ANY" + SPACE + "ANY" + SPACE + "ANY" + DOT + SPACE + uri("one") + SPACE + uri("two") + SPACE + quote("three") + OPT_SPACE + CLOSE_CURLY, query.toString());
}
use of org.apache.jena.sparql.core.TriplePath in project jena by apache.
the class WhereHandlerTest method testAddAllOnEmpty.
@Test
public void testAddAllOnEmpty() {
Query query2 = new Query();
WhereHandler handler2 = new WhereHandler(query2);
handler2.addWhere(new TriplePath(new Triple(NodeFactory.createURI("one"), NodeFactory.createURI("two"), NodeFactory.createLiteral("three"))));
handler.addAll(handler2);
assertContainsRegex(WHERE + OPEN_CURLY + uri("one") + SPACE + uri("two") + SPACE + quote("three") + OPT_SPACE + CLOSE_CURLY, query.toString());
}
use of org.apache.jena.sparql.core.TriplePath in project jena by apache.
the class WhereHandlerTest method testAddOptionalAnonymous.
@Test
public void testAddOptionalAnonymous() {
handler.addOptional(new TriplePath(new Triple(Node.ANY, RDF.first.asNode(), Node.ANY)));
assertContainsRegex(WHERE + OPEN_CURLY + "OPTIONAL" + SPACE + OPEN_CURLY + "ANY" + SPACE + uri("http://www\\.w3\\.org/1999/02/22-rdf-syntax-ns#first") + SPACE + "ANY" + OPT_SPACE + CLOSE_CURLY + CLOSE_CURLY, query.toString());
}
use of org.apache.jena.sparql.core.TriplePath in project jena by apache.
the class WhereHandlerTest method testAddWhereStrings.
@Test
public void testAddWhereStrings() {
handler.addWhere(new TriplePath(new Triple(NodeFactory.createURI("one"), NodeFactory.createURI("two"), NodeFactory.createURI("three"))));
assertContainsRegex(WHERE + OPEN_CURLY + uri("one") + SPACE + uri("two") + SPACE + uri("three") + OPT_SPACE + CLOSE_CURLY, query.toString());
}
Aggregations