changeset 2266:dfdc00c4c8fb

syncegraph.shorten more cases
author drewp@bigasterisk.com
date Mon, 29 May 2023 11:48:28 -0700
parents 18d6bdd422f2
children 7796bc3e46b1
files light9/web/SyncedGraph.ts
diffstat 1 files changed, 10 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/light9/web/SyncedGraph.ts	Mon May 29 11:48:00 2023 -0700
+++ b/light9/web/SyncedGraph.ts	Mon May 29 11:48:28 2023 -0700
@@ -92,9 +92,16 @@
 
   // 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;
   }