public String stringValue() { return getID(); } }
/** * Construct an <code>xsd:dateTime</code> literal. * * Beware that although this is constructed from a Java {@link Date} * parameter, the datatype of the created literal is not * <code>xsd:date</code>. * * @param date the date value of the literal */ public LiteralImpl(Date date) { this(XSD.getLexicalForm(date), XSD.DATE_TIME_URI); }
public String getLexicalForm() { String dateTime = XSD.getLexicalFormOfDate(date); return dateTime; }
public org.openrdf.model.Value getRDFNode() { return new URIReferenceImpl(uri); }
public org.openrdf.model.Value getRDFNode() { return new LiteralImpl(str); }
protected Value globalizeBlankNode(long localNode, SPObject spObject) throws GlobalizeException { return (spObject == null) ? new BlankNodeImpl(localNode) : spObject.getRDFNode(); }
static SPDateTimeImpl newInstance(String lexicalForm) { try { Date date = XSD.parseLexicalForm(lexicalForm); return new SPDateTimeImpl(date); } catch (Exception ex) { throw new IllegalArgumentException("Cannot parse date: " + lexicalForm, ex); } }
/** * Compare variable name for equality. Blank node is not used in the * comparison. * * @param obj The object to compare against. * @return True if the objects have the same variable name. */ public boolean equals(Object obj) { boolean returnValue = false; // Object must not be null if (obj != null) { try { VariableNodeImpl tmpNode = (VariableNodeImpl) obj; // Ensure that both data type URIs are null or are equal by their // string values. if (getVariableName().equals(tmpNode.getVariableName())) { returnValue = true; } } catch (ClassCastException cce) { // Leave return value to be false. } } return returnValue; }
/** * 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"); } }
/** * METHOD TO DO * * @param object PARAMETER TO DO * @return RETURNED VALUE TO DO */ public int compareTo(java.lang.Object object) { if (object instanceof BNode) { return 1; } if (object instanceof Literal) { return -1; } else if (object instanceof URI) { return toString().compareTo(((URI) object).toString()); } else { throw new ClassCastException("Not an RDF node"); } } }
/** * Comparison is by the <var>text</var> property. * * @param object PARAMETER TO DO * @return RETURNED VALUE TO DO */ public int compareTo(java.lang.Object object) { if (object instanceof BNode) { return 1; } if (object instanceof URI) { return 1; } else if (object instanceof Literal) { Literal literal = (Literal) object; return getLabel().compareTo(literal.getLabel()); } else { throw new ClassCastException("Not an RDF node"); } } }
public void execute(OperationContext operationContext, SystemResolver systemResolver, DatabaseMetadata metadata) throws Exception { try { long model = systemResolver.lookupPersistent(new URIReferenceImpl(modelURI)); result = systemResolver.modelExists(model); } catch (LocalizeException le) { result = false; } }
/** * Returns the lexical form of the XSD dateTime value according to * "3.2.7.2 Canonical representation" of * http://www.w3.org/TR/2004/REC-xmlschema-2-20041028/ * with the following exceptions: * - Timezones are not supported * - Dates before 1 CE (i.e. 1 AD) are handled according to ISO 8601:2000 * Second Edition: * "0000" is the lexical representation of 1 BCE * "-0001" is the lexical representation of 2 BCE * @return the lexical form of the XSD dateTime value */ public String getLexicalForm() { return XSD.getLexicalForm(date); }
public org.openrdf.model.Value getRDFNode() { if (typeURI == null) { return new LiteralImpl(getLexicalForm(), ""); } else if (typeURI.getNamespace().equals(SPTypedLiteral.LANG_NS)){ return new LiteralImpl(getLexicalForm(), typeURI.getLocalName()); } else { return new LiteralImpl(getLexicalForm(), typeURI); } }
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(); }
static SPDateImpl newInstance(String lexicalForm) { try { Date date = XSD.parseLexicalForm(lexicalForm); return new SPDateImpl(date); } catch (Exception ex) { throw new IllegalArgumentException("Cannot parse date: " + lexicalForm); } }
public URI mapToModelTypeURI(URI modelURI) throws QueryException { try { if (logger.isDebugEnabled()) logger.debug("Finding modelTypeURI for " + modelURI); long rawModel = systemResolver.localize(new URIReferenceImpl(modelURI)); long canModel = getCanonicalModel(rawModel); URI modelTypeURI = findModelTypeURI(canModel); if (logger.isDebugEnabled()) { logger.debug("Mapped " + modelURI + " via " + rawModel + ":" + canModel + " to ModelTypeURI: " + modelTypeURI); } return modelTypeURI; } catch (GlobalizeException eg) { throw new QueryException("Failed to map model to modelType", eg); } catch (LocalizeException el) { throw new QueryException("Failed to map model to modelType", el); } }
/** * 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; } }
/** * Change a model's presence in the system model (<code>#</code>). * * @param model the model to add or remove * @param present whether to add or remove the model from the system model * @throws ResolverException if the system model wasn't updated */ private void setModelPresenceInSystemModel(long model, URI modelTypeURI, boolean present) throws ResolverException, LocalizeException { // Check whether we're capable of system model operations if (systemResolver == null) { throw new ResolverException("Resolver created without a system model"); } setModelPresenceInSystemModel(model, resolverSession.localizePersistent(new URIReferenceImpl(modelTypeURI)), present); }