@Test(expected = Exception.class) public void testInvalidTriplePredicate() { final BlankNode subject = factory.createBlankNode("b1"); final BlankNode predicate = factory.createBlankNode("b2"); final BlankNode object = factory.createBlankNode("b3"); factory.createTriple(subject, (IRI) predicate, object); }
TermMapImpl(RDF rdf, String columnName) { super(rdf); this.columnName = requireNonNull(columnName); this.termMapType = TermMapType.COLUMN_VALUED; setDefaultTermType(); setNode(getRDF().createBlankNode()); }
R2RMLViewImpl(RDF c, String sqlQuery) { super(c); setSqlQuery(sqlQuery); versionList = new ArrayList<>(); setNode(getRDF().createBlankNode()); }
TermMapImpl(RDF rdf, Template template) { super(rdf); this.template = requireNonNull(template); this.termMapType = TermMapType.TEMPLATE_VALUED; setDefaultTermType(); setNode(getRDF().createBlankNode()); }
RefObjectMapImpl(RDF c, TriplesMap parentMap) { super(c); joinList = new ArrayList<Join>(); setParentMap(parentMap); setNode(getRDF().createBlankNode()); }
private List<Quad> auditData(final IRI subject, final Session session, final List<IRI> types) { final List<Quad> data = new ArrayList<>(); final BlankNode bnode = rdf.createBlankNode(); data.add(rdf.createQuad(PreferAudit, subject, PROV.wasGeneratedBy, bnode)); types.forEach(t -> data.add(rdf.createQuad(PreferAudit, bnode, type, t))); data.add(rdf.createQuad(PreferAudit, bnode, PROV.wasAssociatedWith, session.getAgent())); data.add(rdf.createQuad(PreferAudit, bnode, PROV.atTime, rdf.createLiteral(session.getCreated().toString(), XSD.dateTime))); session.getDelegatedBy().ifPresent(delegate -> data.add(rdf.createQuad(PreferAudit, bnode, PROV.actedOnBehalfOf, delegate))); return data; } }
public SQLBaseTableOrViewImpl(RDF c, String tableName) { super(c); setTableName(tableName); setNode(getRDF().createBlankNode()); }
@Test public void testCreateBlankNodeIdentifierEmpty() throws Exception { try { factory.createBlankNode(""); } catch (final IllegalArgumentException e) { // Expected exception } }
TriplesMapImpl(RDF rdf, LogicalTable lt, SubjectMap sm) { super(rdf); pomList = new ArrayList<>(); setLogicalTable(lt); setSubjectMap(sm); setNode(getRDF().createBlankNode()); }
@Test public void testCreateBlankNodeIdentifier() throws Exception { factory.createBlankNode("example1"); }
TermMapImpl(RDF rdf, RDFTerm constant) { super(rdf); this.constVal = requireNonNull(constant); if(constant instanceof BlankNode){ throw new IllegalArgumentException("BlankNode cannot be used as constant"); } else if (constant instanceof IRI){ this.termTypeIRI = getRDF().createIRI(R2RMLVocabulary.TERM_IRI); } else {// if (constant instanceof Literal) this.termTypeIRI = getRDF().createIRI(R2RMLVocabulary.TERM_LITERAL); } this.termMapType = TermMapType.CONSTANT_VALUED; setNode(getRDF().createBlankNode()); }
public JoinImpl(RDF rdf, String childCol, String parentCol) { super(rdf); setChild(childCol); setParent(parentCol); setNode(getRDF().createBlankNode()); }
@Test public void testCreateBlankNode() throws Exception { final BlankNode bnode = factory.createBlankNode(); final BlankNode bnode2 = factory.createBlankNode(); assertNotEquals("Second blank node has not got a unique internal identifier", bnode.uniqueReference(), bnode2.uniqueReference()); }
@Test public void hashCodeBlankNode() throws Exception { final BlankNode bnode1 = factory.createBlankNode(); assertEquals(bnode1.uniqueReference().hashCode(), bnode1.hashCode()); }
@Test public void testCreateBlankNodeIdentifierTwice() throws Exception { BlankNode bnode1, bnode2, bnode3; bnode1 = factory.createBlankNode("example1"); bnode2 = factory.createBlankNode("example1"); bnode3 = factory.createBlankNode("differ"); // We don't know what the identifier is, but it MUST be the same assertEquals(bnode1.uniqueReference(), bnode2.uniqueReference()); // We don't know what the ntriplesString is, but it MUST be the same assertEquals(bnode1.ntriplesString(), bnode2.ntriplesString()); // and here it MUST differ assertNotEquals(bnode1.uniqueReference(), bnode3.uniqueReference()); assertNotEquals(bnode1.ntriplesString(), bnode3.ntriplesString()); }
@Test public void testCreateTripleBnodeBnode() { final BlankNode subject = factory.createBlankNode("b1"); final IRI predicate = factory.createIRI("http://example.com/pred"); final BlankNode object = factory.createBlankNode("b2"); final Triple triple = factory.createTriple(subject, predicate, object); // bnode equivalence should be OK as we used the same // factory and have not yet inserted Triple into a Graph assertEquals(subject, triple.getSubject()); assertEquals(predicate, triple.getPredicate()); assertEquals(object, triple.getObject()); }
@Test public void testBnodes() { final BlankNode bn1 = rdf.createBlankNode(); final BlankNode bn2 = rdf.createBlankNode(); final Triple triple = rdf.createTriple(bn1, DC.subject, bn2); final LabelledTriple t = new LabelledTriple(triple, null, null); assertEquals(bn1.ntriplesString(), t.getSubject(), "Subject bnode value doesn't match!"); assertEquals(bn2.ntriplesString(), t.getObject(), "Object bnode value doesn't match!"); assertEquals(bn2.ntriplesString(), t.getObjectLabel(), "Object bnode label doesn't match!"); } }
@Test public void testCreateGraph() throws Exception { try (final Graph graph = factory.createGraph(); final Graph graph2 = factory.createGraph()) { assertEquals("Graph was not empty", 0, graph.size()); graph.add(factory.createBlankNode(), factory.createIRI("http://example.com/"), factory.createBlankNode()); assertNotSame(graph, graph2); assertEquals("Graph was empty after adding", 1, graph.size()); assertEquals("New graph was not empty", 0, graph2.size()); } }
@Test public void testCreateTripleBnodeIRI() { final BlankNode subject = factory.createBlankNode("b1"); final IRI predicate = factory.createIRI("http://example.com/pred"); final IRI object = factory.createIRI("http://example.com/obj"); final Triple triple = factory.createTriple(subject, predicate, object); // bnode equivalence should be OK as we used the same // factory and have not yet inserted Triple into a Graph assertEquals(subject, triple.getSubject()); assertEquals(predicate, triple.getPredicate()); assertEquals(object, triple.getObject()); }
@Test public void testCreateTripleBnodeTriple() { final BlankNode subject = factory.createBlankNode(); final IRI predicate = factory.createIRI("http://example.com/pred"); final Literal object = factory.createLiteral("Example", "en"); final Triple triple = factory.createTriple(subject, predicate, object); // bnode equivalence should be OK as we used the same // factory and have not yet inserted Triple into a Graph assertEquals(subject, triple.getSubject()); assertEquals(predicate, triple.getPredicate()); assertEquals(object, triple.getObject()); }