Commit b96b253c authored by Laurent Wouters's avatar Laurent Wouters
Browse files

[fix] Use equivalent URIs for aliases lookup

parent b002ff088e34
......@@ -19,7 +19,7 @@
******************************************************************************/
import * as $rdf from "rdflib";
import { uriEscape, uriUnescape } from "./uris";
import { uriEquivalents } from "./uris";
/**
* A single RDF entity that may have aliases
......@@ -351,8 +351,7 @@ export class RdfEntityStore {
registered_aliases.forEach(onUri);
}
// look for equivalent URIs
onUri(uriEscape(uris[i]));
onUri(uriUnescape(uris[i]));
uriEquivalents(uris[i]).forEach(onUri);
}
}
}
......@@ -76,3 +76,17 @@ export function uriUnescape(uri: string): string {
}
return result;
}
/**
* Gets the sets of equivalents URIs (escaped and unescaped)
* @param uri Thr original URI
*/
export function uriEquivalents(uri: string): string[] {
let result = [];
result.push(uri);
let candidate = uriEscape(uri);
if (result.indexOf(candidate) < 0) result.push(candidate);
candidate = uriUnescape(uri);
if (result.indexOf(candidate) < 0) result.push(candidate);
return result;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment