Changeset - dfdc00c4c8fb
[Not reviewed]
default
0 1 0
drewp@bigasterisk.com - 20 months ago 2023-05-29 18:48:28
drewp@bigasterisk.com
syncegraph.shorten more cases
1 file changed with 10 insertions and 3 deletions:
0 comments (0 inline, 0 general)
light9/web/SyncedGraph.ts
Show inline comments
 
@@ -92,9 +92,16 @@ export class SyncedGraph {
 

	
 
  // Uri(shorten(u)).value==u
 
  shorten(uri: N3.NamedNode): string {
 
    const prefix = "http://light9.bigasterisk.com/";
 
    if (uri.value.startsWith(prefix)) {
 
      return ":" + uri.value.substring(prefix.length);
 
    for (let row of [
 
      { sh: "dev", lo: "http://light9.bigasterisk.com/theater/vet/device/" },
 
      { sh: "effect", lo: "http://light9.bigasterisk.com/effect/" },
 
      { sh: "", lo: "http://light9.bigasterisk.com/" },
 
      { sh: "rdfs", lo: "http://www.w3.org/2000/01/rdf-schema#" },
 
      { sh: "xsd", lo: "http://www.w3.org/2001/XMLSchema#" },
 
    ]) {
 
      if (uri.value.startsWith(row.lo)) {
 
        return row.sh + ":" + uri.value.substring(row.lo.length);
 
      }
 
    }
 
    return uri.value;
 
  }
0 comments (0 inline, 0 general)