/** * Parses the given input as a blank node. * * @param blankNodeAsString the blank node string value. * @return the {@link Node} Blank node representation of the given value. */ private static Node internalAsBlankNode(final String blankNodeAsString) { return NodeFactory.createAnon(AnonId.create(blankNodeAsString.substring(2))); }
/** make a blank node with a fresh anon id */ public static Node createAnon() { return createAnon( AnonId.create() ); }
private void boostrap(List<Variable> variables) { for(Variable variable:variables) { Resource blankNode = this.model.createResource(AnonId.create(variable.name())); this.pendingResources.add(blankNode); this.resourceTarget.put(blankNode, variable); } }
/** * Since STANBOL-765 BlankNodes are converted to URIs if a {@link #bnodePrefix} * is configured. This also means that one needs to expect calls to the * {@link RDFBackend} interface with transformed Nodes. <p> * This method ensures that if someone requests an uri {@link Node} for a * URI that represents a transformed Bnode (when the URI starts with * {@link #bnodePrefix}) that the according bnode {@link Node} is created * @param node the node * @return */ @Override public Node createURI(String uri) { if(bnodePrefix != null && uri.startsWith(bnodePrefix)){ return NodeFactory.createAnon(AnonId.create(uri.substring(bnodePrefix.length()))); } else { return super.createURI(uri); } } /**
@Override public Node_Blank read(Kryo kryo, Input input, Class<Node_Blank> type) { final String label = input.readString(); final Node_Blank retNode = (Node_Blank) Node.createAnon(AnonId.create(label)); return retNode; }
/** * Since STANBOL-765 BlankNodes are converted to URIs if a {@link #bnodePrefix} * is configured. This also means that one needs to expect calls to the * {@link RDFBackend} interface with transformed Nodes. <p> * This method ensures that if someone requests an uri {@link Node} for a * URI that represents a transformed Bnode (when the URI starts with * {@link #bnodePrefix}) that the according bnode {@link Node} is created * @param node the node * @return */ @Override public Node createURI(String uri) { if(bnodePrefix != null && uri.startsWith(bnodePrefix)){ return NodeFactory.createAnon(AnonId.create(uri.substring(bnodePrefix.length()))); } else { return super.createURI(uri); } } /**
@Override public Node_Blank read(Kryo kryo, Input input, Class<Node_Blank> type) { final String label = input.readString(); final Node_Blank retNode = (Node_Blank) Node.createAnon(AnonId.create(label)); return retNode; }
@Override public BlankNode createBlankNode(String id) { // this.modificationCount++; // should be unique across models AnonId anonid = AnonId.create(id); return new JenaBlankNode(com.hp.hpl.jena.graph.NodeFactory.createAnon(anonid)); }
@Override public ResourceHelper blankNode(String bnode) { return new ImmutableResourceHelper(this,this.model().createResource(AnonId.create(bnode))); }
@Override public <T extends PropertyHelper & ResourceHelper & ModelHelper> T withBlankNode(String value) { return addStatement(model().createResource(AnonId.create(value))); }
resource = NodeFactory.createAnon(AnonId.create(id.substring(bnodePrefix.length()))); } else { resource = NodeFactory.createURI(id);
resource = NodeFactory.createAnon(AnonId.create(id.substring(bnodePrefix.length()))); } else { resource = NodeFactory.createURI(id);
/** * @param uriOrId * URI or internal ID of the resource to be created in <code>tempModel</code>. * @param resType * The type of the resource to be created, i.e. named or anonymous one. In case of named, <code>uriOrId</code> will be used as an URI, in case of * anonymous, <code>uriOrId</code> will be used as the internal ID for anonymous resources. * @return A Jena temporary <code>Resource</code> */ protected Resource createTempRes(final String uriOrId, final ResourceTypes resType) { if (resType.equals(ResourceTypes.NAMED)) { return this.tempModel.createResource(uriOrId); } else if (resType.equals(ResourceTypes.ANON)) { final AnonId a = AnonId.create(uriOrId); return this.tempModel.createResource(a); } throw new RDFHelperException("Unexpected error. Using a type that is not defined: " + resType.name() + "-" + resType.ordinal()); }
s = resultModel.createResource(resultSubject); } else if (subjectTemplate.getTermType() == TermType.BLANKNODE) { s = resultModel.createResource(AnonId.create(resultSubject)); if (verbose) log.info("Created blank node subject with id " + s.getId()); } else { s = resultModel.createResource(resultSubject); } else if (subjectTemplate.getTermType() == TermType.BLANKNODE) { s = resultModel.createResource(AnonId.create(resultSubject)); if (verbose) log.info("Created blank node subject with id " + s.getId()); } else { String value = util.fillTemplate(objectTemplate, rs, encodeURLs); if (value != null) { RDFNode o = resultModel.createResource(AnonId.create(value)); if (verbose) log.info("Adding resource triple: <" + s.getURI() + ">, <" + p.getURI() + ">, <" + o.asResource().getURI() + ">"); Statement st = resultModel.createStatement(s, p, o);