[Mulgara-svn] r1810 - trunk/src/jar/query/java/org/mulgara/query/filter/value
pag at mulgara.org
pag at mulgara.org
Tue Oct 6 06:42:21 UTC 2009
Author: pag
Date: 2009-10-05 23:42:20 -0700 (Mon, 05 Oct 2009)
New Revision: 1810
Modified:
trunk/src/jar/query/java/org/mulgara/query/filter/value/IRI.java
Log:
Added support for IRIs to carry QNames with them
Modified: trunk/src/jar/query/java/org/mulgara/query/filter/value/IRI.java
===================================================================
--- trunk/src/jar/query/java/org/mulgara/query/filter/value/IRI.java 2009-10-06 06:41:42 UTC (rev 1809)
+++ trunk/src/jar/query/java/org/mulgara/query/filter/value/IRI.java 2009-10-06 06:42:20 UTC (rev 1810)
@@ -13,6 +13,8 @@
import java.net.URI;
+import javax.xml.namespace.QName;
+
import org.jrdf.graph.Node;
import org.mulgara.query.QueryException;
import org.mulgara.query.filter.Context;
@@ -38,19 +40,40 @@
/** The URI held by this object */
private final URI value;
+ private final QName qname;
+
/**
* Creates the value to wrap the uri.
* @param u The URI to wrap
*/
public IRI(URI u) {
value = u;
+ qname = null;
}
+ /**
+ * Creates the value to wrap the uri.
+ * @param u The URI to wrap
+ * @param q The QName for this uri.
+ */
+ public IRI(URI u, QName q) {
+ value = u;
+ this.qname = q;
+ }
+
/** {@inheritDoc} */
public URI getValue() {
return value;
}
+ /**
+ * Gets the qname for this IRI, if one exists.
+ * @return The QName of the IRI, or <code>null</code> if none exists.
+ */
+ public QName getQName() {
+ return qname;
+ }
+
/** {@inheritDoc} */
public Node getJRDFValue() {
return new URIReferenceImpl(value);
@@ -105,4 +128,7 @@
/** This value does not need a context */
public void addContextListener(ContextOwner l) { }
+ public String toString() {
+ return qname == null ? value.toString() : value.toString() + " (" + qname + ")";
+ }
}
More information about the Mulgara-svn
mailing list