org.apache.commons.rdf.api.RDF.createBlankNode()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.9k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.apache.commons.rdf.api.RDF.createBlankNode方法的一些代码示例,展示了RDF.createBlankNode的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RDF.createBlankNode方法的具体详情如下:
包路径:org.apache.commons.rdf.api.RDF
类名称:RDF
方法名:createBlankNode

RDF.createBlankNode介绍

[英]Create a new blank node.

The returned blank node MUST NOT be equal to any existing BlankNode instances according to BlankNode#equals(Object).
[中]创建一个新的空白节点。
根据BlankNode#equals(Object),返回的空白节点不能等于任何现有的BlankNode实例。

代码示例

代码示例来源:origin: org.apache.commons/commons-rdf-api

@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);
}

代码示例来源:origin: eu.optique-project/r2rml-api-core

TermMapImpl(RDF rdf, String columnName) {
  super(rdf);
  this.columnName = requireNonNull(columnName);
  this.termMapType = TermMapType.COLUMN_VALUED;
  setDefaultTermType();
  setNode(getRDF().createBlankNode());
}

代码示例来源:origin: eu.optique-project/r2rml-api-core

R2RMLViewImpl(RDF c, String sqlQuery) {
  super(c);
  setSqlQuery(sqlQuery);
  versionList = new ArrayList<>();
  setNode(getRDF().createBlankNode());
}

代码示例来源:origin: eu.optique-project/r2rml-api-core

TermMapImpl(RDF rdf, Template template) {
  super(rdf);
  this.template = requireNonNull(template);
  this.termMapType = TermMapType.TEMPLATE_VALUED;
  setDefaultTermType();
  setNode(getRDF().createBlankNode());
}

代码示例来源:origin: eu.optique-project/r2rml-api-core

RefObjectMapImpl(RDF c, TriplesMap parentMap) {
  super(c);
  joinList = new ArrayList<Join>();
  setParentMap(parentMap);
  setNode(getRDF().createBlankNode());
}

代码示例来源:origin: trellis-ldp/trellis

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;
  }
}

代码示例来源:origin: eu.optique-project/r2rml-api-core

public SQLBaseTableOrViewImpl(RDF c, String tableName) {
  super(c);
  setTableName(tableName);
  setNode(getRDF().createBlankNode());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test
public void testCreateBlankNodeIdentifierEmpty() throws Exception {
  try {
    factory.createBlankNode("");
  } catch (final IllegalArgumentException e) {
    // Expected exception
  }
}

代码示例来源:origin: eu.optique-project/r2rml-api-core

TriplesMapImpl(RDF rdf, LogicalTable lt, SubjectMap sm) {
  super(rdf);
  pomList = new ArrayList<>();
  setLogicalTable(lt);
  setSubjectMap(sm);
  setNode(getRDF().createBlankNode());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test
public void testCreateBlankNodeIdentifier() throws Exception {
  factory.createBlankNode("example1");
}

代码示例来源:origin: eu.optique-project/r2rml-api-core

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());
}

代码示例来源:origin: eu.optique-project/r2rml-api-core

public JoinImpl(RDF rdf, String childCol, String parentCol) {
  super(rdf);
  setChild(childCol);
  setParent(parentCol);
  setNode(getRDF().createBlankNode());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@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());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@Test
public void hashCodeBlankNode() throws Exception {
  final BlankNode bnode1 = factory.createBlankNode();
  assertEquals(bnode1.uniqueReference().hashCode(), bnode1.hashCode());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@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());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@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());
}

代码示例来源:origin: trellis-ldp/trellis

@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!");
  }
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@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());
  }
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@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());
}

代码示例来源:origin: org.apache.commons/commons-rdf-api

@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());
}

相关文章