public String stringValue() { return getID(); } }
/** * Gives Literals, URIReference and BlankNodes an order. * * @param object the RDF object to compare. * @return -1 if Literal or URIReference otherwise performance comparTo. */ public int compareTo(java.lang.Object object) { if (object instanceof Literal) { return -1; } else if (object instanceof URI) { return -1; } else if (object instanceof BNode) { // FIXME: this is ugly and I sincerely hope we can figure out a better // way to implement comparisons by Java reference value return toString().compareTo(((BNode)object).toString()); } else { throw new ClassCastException("Not an RDF node"); } }
if (bi.getNodeId() > 0) return bi.getNodeId(); if ((bi.getNodeId() == 0) && ((flags & WRITE_MASK) == READ)) { throw new LocalizeException(node, "Attempt to get a node ID from a non-allocated BlankNodeImpl in a read phase"); if ((bi.getNodeId() < 0) && ((flags & STORE_MASK) == PERSIST)) { bi.setNodeId(persistentNodePool.newNode()); } else if (bi.getNodeId() == 0) { if ((flags & STORE_MASK) == TEMP) { bi.setNodeId(-temporaryNodePool.newNode()); } else { bi.setNodeId(persistentNodePool.newNode()); return bi.getNodeId();
protected Value globalizeBlankNode(long localNode, SPObject spObject) throws GlobalizeException { return (spObject == null) ? new BlankNodeImpl(localNode) : spObject.getRDFNode(); }
long nodeId; if (node instanceof BlankNodeImpl) { nodeId = ((BlankNodeImpl)node).getNodeId(); if (nodeId < 0) { long foreignId = -nodeId;
private long newBlankNode() throws NodePoolException, LocalizeException { return persist ? session.newBlankNode() : session.localize(new BlankNodeImpl()); }
/** * Reproducible hashcode for the object. * * @return Hashcode of the nodeid. */ public int hashCode() { return getID().hashCode(); }
/** * Compare node for equality. * * @param obj The object to compare against. * @return True if the object evaluates as an equivalent blank node. */ public boolean equals(Object obj) { if (obj == null) { return false; } else if (obj == this) { return true; } else if (obj instanceof BlankNodeImpl) { return this.nodeId != 0 && this.nodeId == ((BlankNodeImpl)obj).nodeId; } else if (obj instanceof BNode) { BNode otherNode = (BNode)obj; return this.getID().equals(otherNode.getID()); } else { return false; } }