[Mulgara-svn] r1801 - trunk/src/jar/querylang/java/org/mulgara/sparql/parser
pag at mulgara.org
pag at mulgara.org
Tue Oct 6 06:33:45 UTC 2009
Author: pag
Date: 2009-10-05 23:33:44 -0700 (Mon, 05 Oct 2009)
New Revision: 1801
Modified:
trunk/src/jar/querylang/java/org/mulgara/sparql/parser/QueryStructureImpl.java
Log:
Provides hints to IRIs to find QNames
Modified: trunk/src/jar/querylang/java/org/mulgara/sparql/parser/QueryStructureImpl.java
===================================================================
--- trunk/src/jar/querylang/java/org/mulgara/sparql/parser/QueryStructureImpl.java 2009-10-06 06:32:47 UTC (rev 1800)
+++ trunk/src/jar/querylang/java/org/mulgara/sparql/parser/QueryStructureImpl.java 2009-10-06 06:33:44 UTC (rev 1801)
@@ -266,9 +266,9 @@
}
/**
- * Create a new IRI based on a prefixed name.Note that this implementation
+ * Create a new IRI based on a prefixed name. Note that this implementation
* only accepts URIs, and not the more complete IRI.
- * @param r The string containing the image of the IRI
+ * @param r The string containing the image of the prefixed name.
* @return A new {@link org.mulgara.sparql.parser.cst.IRIReference} for the string image.
* @throws ParseException The r parameter was not a syntactically valid URI.
*/
@@ -277,11 +277,12 @@
Matcher m = pnamePattern.matcher(r);
if (!m.matches()) {
// either a normal IRI, or one with a BASE
- return isRelative(r) ? new IRIReference(base + r, "<" + r + ">") : new IRIReference(r);
+ return isRelative(r) ? new IRIReference(base, null, r) : new IRIReference(r, prefixes);
}
- // extract the prefix, and attempt to convert to a URI before creating the reference
- URI ns = prefixes.get(m.group(1));
- return ns == null ? new IRIReference(r) : new IRIReference(ns.toString() + m.group(2), r);
+ String prefix = m.group(1);
+ String localPart = m.group(2);
+ URI namespace = prefixes.get(prefix);
+ return namespace == null ? new IRIReference(r, prefixes) : new IRIReference(namespace, prefix, localPart);
}
/**
More information about the Mulgara-svn
mailing list