QNameProvider.java revision 2
8900b9eb2514c07047541833286428572493a9fdStéphane Graber/*
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi * Created on May 13, 2004
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi */
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumipackage org.mindswap.utils;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumiimport java.net.URI;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumiimport java.util.Hashtable;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumiimport java.util.Map;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumiimport java.util.Set;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumiimport org.mindswap.owl.vocabulary.OWL;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumiimport org.mindswap.owl.vocabulary.RDF;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumiimport org.mindswap.owl.vocabulary.RDFS;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumiimport org.mindswap.owl.vocabulary.XSD;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi/**
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi * A class to convert URI's to QNames. Borrowed from SWOOP code.
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi *
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi * @author Evren Sirin
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi */
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumipublic class QNameProvider {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi // stores a map of uri -> prefix
8900b9eb2514c07047541833286428572493a9fdStéphane Graber Map uriToPrefix;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi Map prefixToUri;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi /**
faefa7f8584a7d1567df2e6f1f9240a28a6466abStéphane Graber *
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi */
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi public QNameProvider() {
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi uriToPrefix = new Hashtable();
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi prefixToUri = new Hashtable();
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi // initialize it with standard stuff
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi setMapping("owl", OWL.ns);
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi setMapping("rdf", RDF.ns);
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi setMapping("rdfs", RDFS.ns);
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi setMapping("xsd", XSD.ns);
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi }
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi public static boolean isNameStartChar(char ch) {
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi return (Character.isLetter(ch) || ch == '_');
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi }
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi public static boolean isNameChar(char ch) {
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi return (isNameStartChar(ch) || Character.isDigit(ch) || ch == '.' || ch == '-');
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi }
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi public static int findNameStartIndex(String str) {
6127da6b3f5815028bee187ac98840cd94313841KATOH Yasufumi char[] strChars = str.toCharArray();
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi int nameStartIndex = -1;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi boolean foundNameChar = false;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi for(int strIndex = strChars.length - 1; strIndex >= 0; strIndex--) {
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi char letter = strChars[strIndex];
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi if(isNameStartChar(letter)) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi nameStartIndex = strIndex;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi foundNameChar = true;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi else if(foundNameChar && !isNameChar(letter)) {
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi break;
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi }
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi }
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi return nameStartIndex;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi }
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi public static int findLastNameIndex(String str) {
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi char[] strChars = str.toCharArray();
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi int nameIndex = -1;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi for(int strIndex = strChars.length - 1; strIndex >= 0; strIndex--) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi char letter = strChars[strIndex];
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi if(isNameChar(letter)) {
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi nameIndex = strIndex;
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi }
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi else {
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi break;
ea4cadbfac471dbdc5ab9ed6f04f6ae3f965a7caKATOH Yasufumi }
ea4cadbfac471dbdc5ab9ed6f04f6ae3f965a7caKATOH Yasufumi }
ea4cadbfac471dbdc5ab9ed6f04f6ae3f965a7caKATOH Yasufumi return nameIndex;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi }
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi public static int findNextNonNameIndex(String str, int startIndex) {
ea4cadbfac471dbdc5ab9ed6f04f6ae3f965a7caKATOH Yasufumi char[] strChars = str.toCharArray();
ea4cadbfac471dbdc5ab9ed6f04f6ae3f965a7caKATOH Yasufumi int nameIndex = startIndex;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi for(nameIndex = startIndex; nameIndex < strChars.length; nameIndex++) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi char letter = strChars[nameIndex];
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi if(!isNameChar(letter)) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi break;
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi }
baeebd0d79027ccaddf00e33238d26d31a92c221Stéphane Graber }
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi return nameIndex;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi protected static String[] splitURI(String uriString) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi int nameStart, prefixStart, prefixEnd;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi String base, prefix, name;
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi String[] bpn = new String[3];
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi nameStart = findLastNameIndex(uriString);
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi if(nameStart < 0) {
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi //System.out.println("Couldn't find name for "+uriString);
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi return null;
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi name = uriString.substring(nameStart);
9a97d4e4bdf331bb2c2b8ed14bcefa53358c288fKATOH Yasufumi if(nameStart == 0) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi //System.out.println("Name starts at beginning");
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi base = "";
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi prefix = "a"; // Pick a unique prefix later
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi else {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi base = uriString.substring(0, nameStart);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi //System.out.println("Uri: "+ uri + " Base: " +base);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi prefixStart = findNameStartIndex(base);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi if(prefixStart < 0) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi //System.out.println("Prefix < 0");
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi prefix = "b"; // Pick a uniqe prefix later
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi else {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi prefixEnd = findNextNonNameIndex(base, prefixStart + 1);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi prefix = uriString.substring(prefixStart, prefixEnd);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi bpn[0] = base;
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi bpn[1] = prefix;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi bpn[2] = name;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi return bpn;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi public String getPrefix(String uri) {
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi return (String) uriToPrefix.get(uri);
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi }
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi public String getURI(String prefix) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi return (String) prefixToUri.get(prefix);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi public void removePrefix(String prefix) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi String uri = (String) prefixToUri.remove(prefix);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi if(uri != null)
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi uriToPrefix.remove(uri);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi public boolean setMapping(String prefix, String uri) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi String currentUri = getURI(prefix);
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi if(currentUri == null) {
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi //System.out.println("Setting prefix "+prefix+": "+uri);
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi prefixToUri.put(prefix, uri);
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi uriToPrefix.put(uri, prefix);
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi return true;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi else if(currentUri == uri) {
38d626f8bee1a2163f221f0c274c289a66bc08d2KATOH Yasufumi return true;
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi }
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi else {
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi return false;
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi }
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi }
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi public Set getPrefixSet() {
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi return prefixToUri.keySet();
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi }
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi public Set getURISet() {
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi return uriToPrefix.keySet();
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi }
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi public String shortForm(URI uri) {
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi return shortForm(uri.toString());
241c3744ca7e43533f8cf76fb5972d715b473aa7KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi public String shortForm(String uri) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi //System.out.println("Shortform for " + uri);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi return shortForm(uri, true);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi public String shortForm(String uri, boolean default_to_uri) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi String[] bpn = splitURI(uri);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi String base, possible_prefix, prefix, name;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi String qname;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi if(bpn == null) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi if(default_to_uri) {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi return uri;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi else {
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi return null;
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi }
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi base = bpn[0];
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi possible_prefix = bpn[1];
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi name = bpn[2];
fe8e3acfa28a4ce0ab6d53d0417884c5124d04fcKATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi if(possible_prefix.endsWith(".owl") || possible_prefix.endsWith(".rdf")
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi || possible_prefix.endsWith(".xml"))
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi possible_prefix = possible_prefix.substring(0, possible_prefix
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi .length() - 4);
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi if(Character.isLowerCase(possible_prefix.charAt(1)))
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi possible_prefix = Character.toLowerCase(possible_prefix.charAt(0))
a5ba96715d4ef264c43d4f187251de491ba198c0KATOH Yasufumi + possible_prefix.substring(1, possible_prefix.length());
57da8c32f85c0255efa61ee32e260068afdaa565KATOH Yasufumi
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi prefix = getPrefix(base);
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi if(prefix == null) {
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi // Check prefix for uniqueness
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi prefix = possible_prefix;
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi int mod = 0;
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi while(!setMapping(prefix, base)) {
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi prefix = possible_prefix + mod;
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi mod++;
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi }
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi }
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi qname = prefix.length() == 0 ? name : prefix + ":" + name;
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi return qname;
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi }
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi public String longForm(String qname) {
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi String[] str = qname.split(":");
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi String prefix = str[0];
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi String localName = str[1];
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi String uri = getURI(prefix);
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi if(uri == null)
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi throw new IllegalArgumentException("Prefix " + prefix + " is not known!");
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi
dc421f3aac1f0e516c763dd156629a8ed2a7b4caKATOH Yasufumi return uri + localName;
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi }
bb8eca54d6e2edfb10742b121cce194af065068bKATOH Yasufumi}