Examples of BNode


Examples of org.openrdf.model.BNode

  }

  public void testValueRoundTrip2()
    throws Exception
  {
    BNode subj = vf.createBNode();
    URI pred = new URIImpl(EXAMPLE_NS + PAINTS);
    URI obj = new URIImpl(EXAMPLE_NS + GUERNICA);

    testValueRoundTrip(subj, pred, obj);
  }
View Full Code Here

Examples of org.openrdf.model.BNode

  public void testBNodeReuse()
    throws Exception
  {
    con.addStatement(RDF.VALUE, RDF.VALUE, RDF.VALUE);
    assertEquals(1, con.size(null, null, null, false));
    BNode b1 = vf.createBNode();
    con.addStatement(b1, RDF.VALUE, b1);
    con.removeStatements(b1, RDF.VALUE, b1);
    assertEquals(1, con.size(null, null, null, false));
    BNode b2 = vf.createBNode();
    con.addStatement(b2, RDF.VALUE, b2);
    con.addStatement(b1, RDF.VALUE, b1);
    assertEquals(3, con.size(null, null, null, false));
  }
View Full Code Here

Examples of org.openrdf.model.BNode

    this.internal = internal;
  }

  public Value internalize(Value obj) {
    if (obj instanceof BNode) {
      BNode node = (BNode)obj;
      if (external.isInternalBNode(node) && !in.containsKey(node)) {
        BNode b = internal.createBNode(node.getID());
        BNode o = in.putIfAbsent(node, b);
        if (o != null) {
          return o;
        }
        out.put(b, node);
        return b;
View Full Code Here

Examples of org.openrdf.model.BNode

    return c;
  }

  public boolean isNotSignedBNode(Value o) {
    if (o instanceof BNode) {
      BNode node = (BNode)o;
      if (external.isInternalBNode(node) && in.containsKey(o)) {
        return false;
      }
      if (node.getID().endsWith(suffix)) {
        return false;
      }
      return true;
    }
    return false;
View Full Code Here

Examples of org.openrdf.model.BNode

    return false;
  }

  public boolean isSignedBNode(Value o) {
    if (o instanceof BNode) {
      BNode node = (BNode)o;
      if (external.isInternalBNode(node) && in.containsKey(o)) {
        return true;
      }
      if (node.getID().endsWith(suffix)) {
        return true;
      }
      return false;
    }
    return false;
View Full Code Here

Examples of org.openrdf.model.BNode

    return false;
  }

  public Value removeSignature(Value subj) {
    if (subj instanceof BNode) {
      BNode node = (BNode)subj;
      String nodeID = node.getID();
      if (nodeID.endsWith(suffix)) {
        nodeID = nodeID.substring(0, nodeID.length() - suffix.length());
        return new BNodeImpl(nodeID);
      }
      if (external.isInternalBNode(node)) {
        BNode b = in.get(node);
        return b == null ? node : b;
      }
    }
    return subj;
  }
View Full Code Here

Examples of org.openrdf.model.BNode

    ValueFactory vf = getConnection().getValueFactory();

    List<String> columns = Arrays.asList(Protocol.BNODE);
    List<BindingSet> bnodes = new ArrayList<BindingSet>(amount);
    for (int i = 0; i < amount; i++) {
      BNode bnode = createBNode(vf, nodeID, i);
      bnodes.add(new ListBindingSet(columns, bnode));
    }

    return new TupleResultImpl(columns, bnodes);
  }
View Full Code Here

Examples of org.openrdf.model.BNode

                .createLiteral("Test literal");
        Literal testSesameObjectLangLiteral1 = VF.createLiteral("Test literal",
                "en");
        Literal testSesameObjectTypedLiteral1 = VF.createLiteral(
                "Test literal", VF.createURI("urn:test:datatype:1"));
        BNode testSesameSubjectBNode1 = VF.createBNode("subjectBnode1");
        BNode testSesameObjectBNode1 = VF.createBNode("objectBnode1");
        testSesameTripleAllIRI = VF.createStatement(testSesameSubjectUri1,
                testSesamePredicateUri1, testSesameObjectUri1);
        testSesameTriplePlainLiteral = VF.createStatement(
                testSesameSubjectUri1, testSesamePredicateUri1,
                testSesameObjectPlainLiteral1);
View Full Code Here

Examples of org.openrdf.model.BNode

   * @param factory OpenRDF value factory
   * @return the OpenRDF instance wrapped in the given RDF2Go blank node or a
   *         new OpenRDF blank node with the same internal ID.
   */
  public static BNode toOpenRDF(BlankNode node, ValueFactory factory) {
    BNode result = null;
   
    if(node != null) {
      Object underlyingBlankNode = ((AbstractBlankNodeImpl)node).getUnderlyingBlankNode();
     
      if(underlyingBlankNode instanceof BNode) {
View Full Code Here

Examples of org.openrdf.model.BNode

        } catch (NumberFormatException nfe) {
            return;
        }

        final ValueFactory factory = new Any23ValueFactoryWrapper(ValueFactoryImpl.getInstance(), out);
        BNode point = factory.createBNode();
        out.writeTriple(extractionContext.getDocumentURI(), expand("dcterms:related"), point);
        out.writeTriple(point, expand("rdf:type"), expand("geo:Point"));
        out.writeTriple(point, expand("geo:lat"), factory.createLiteral(Float.toString(lat)));
        out.writeTriple(point, expand("geo:long"), factory.createLiteral(Float.toString(lon)));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.