From f3cb4a2f9c2e092d384080a4baa21f6f90c625ac Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Mon, 2 Sep 2024 12:10:38 +0200 Subject: [PATCH 01/16] update namespace --- www/dexpisvg.xslt | 54 +++++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/www/dexpisvg.xslt b/www/dexpisvg.xslt index 6af70ab..38d2771 100644 --- a/www/dexpisvg.xslt +++ b/www/dexpisvg.xslt @@ -1,7 +1,7 @@ @@ -9,7 +9,7 @@ - + @@ -20,42 +20,42 @@ - - + + - + - - + + - + - + - + - + @@ -63,7 +63,7 @@ - + M @@ -81,7 +81,7 @@ - + @@ -137,7 +137,7 @@ - + @@ -196,14 +196,14 @@ - + - + @@ -212,7 +212,7 @@ - + @@ -221,16 +221,16 @@ - + - + - + - + @@ -241,7 +241,7 @@ - + @@ -262,13 +262,13 @@ - + - + @@ -284,14 +284,14 @@ - + - + @@ -312,6 +312,6 @@ - + \ No newline at end of file From 56fe05d9be93ca8c937ca7b8fc43878fcc5e681b Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Mon, 2 Sep 2024 12:13:25 +0200 Subject: [PATCH 02/16] readme --- owl/README.md | 1 + www/dexpi.html | 417 +++++++++++++++++++++++++++++++++++++++++++++++++ www/style.css | 7 + 3 files changed, 425 insertions(+) create mode 100644 owl/README.md create mode 100644 www/dexpi.html create mode 100644 www/style.css diff --git a/owl/README.md b/owl/README.md new file mode 100644 index 0000000..3a2d786 --- /dev/null +++ b/owl/README.md @@ -0,0 +1 @@ +The imf ontology is downloaded [here](https://ns.imfid.org/20240531/). \ No newline at end of file diff --git a/www/dexpi.html b/www/dexpi.html new file mode 100644 index 0000000..5213b8e --- /dev/null +++ b/www/dexpi.html @@ -0,0 +1,417 @@ + + + + + SVG Display + + + + + + + + + + PV4712.02 + + + + F.C. + + F.C. + TV4750.03 + + F.O. + + MNb 47121 75HB13 80 + + + + + + + MNb 47122 75HB13 80 + + + + + + MNb 47123 75HB13 80 + + + + + + + + + MNc 47124 75HB13 80 + + + + 66KL21-80 + + + 75SA21-80 + + + + + 80/50 + + + + + 73KH12-50 + + + + + MNc 47125 73HG12 25 + + + + SV 104.01 + + + MNc 47125 75HB13 50 + + + + + + + MNc 47126 75HB13 50 + + + + + + + + 73KH12-25 + + + + + + + + + + + + + 73KH12-25 + + + + + + 73KH12-50 + + + + + + + + + + + + + + 73KH12-25 + + + + + + + + + + MNc 47127 75HB13 50 Q 80 + + Q80 + + + + + + + + + WKa 47130 75HB13 50 + + + + + + + WKb 47131 75HB13 50 + + + + + + + QSa 47140 75HB13 50 Q 80 + + + + + + + QSb 47141 75HB13 50 Q 80 + + + + + + + + + PI + + + PICSA + + + + HS + + + TICSA + + + + H1007 + Ident + + N1 + + N2 + + N3 + + N4 + + H1008 + Ident + + N1 + + N2 + + N3 + + N4 + + P4711 + Ident + + N1 + + N2 + + P4712 + Ident + + N1 + + href="https://www.example.com"> + + + + N2 + + T4750 + + Ident + + N1 + + N2 + + N3 + + N5 + + N6 + + N7 + + N8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + APPROVED BY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/www/style.css b/www/style.css new file mode 100644 index 0000000..bcf4add --- /dev/null +++ b/www/style.css @@ -0,0 +1,7 @@ +/* ------ style.css ----- */ + +svg a:hover text { + fill: #FF0000; + transition: 0.6s; + cursor:pointer; +} From 649196967180a51f82e525307ac9d7383e3ab7b1 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Mon, 2 Sep 2024 12:14:23 +0200 Subject: [PATCH 03/16] update readme --- owl/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/owl/README.md b/owl/README.md index 3a2d786..0c42146 100644 --- a/owl/README.md +++ b/owl/README.md @@ -1 +1,2 @@ -The imf ontology is downloaded [here](https://ns.imfid.org/20240531/). \ No newline at end of file +The imf ontology is downloaded [here](https://ns.imfid.org/20240531/). +The ontology must be downloaded into this folder and named imf-ontology.owl.ttl \ No newline at end of file From 106ae20c48544941ebabfb0c1818f302600c5585 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Mon, 2 Sep 2024 12:17:31 +0200 Subject: [PATCH 04/16] update gitignore, do not include build files from csproj --- .gitignore | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitignore b/.gitignore index d8f7b82..44cec58 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,7 @@ client/.idea client/Boundaries/Dexpi2Svg/test.svg rml/C03V04.trig www/C03V04.svg +client/Boundaries/Dexpi2Svg/bin +client/Boundaries/Dexpi2Svg/obj +client/Boundaries/Boundaries/bin +client/Boundaries/Boundaries/obj \ No newline at end of file From d3c997b2d3f9c7a69c48b923ae6d873a19a2c8f6 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Mon, 2 Sep 2024 15:42:07 +0200 Subject: [PATCH 05/16] add iri to each name --- www/dexpi.html | 246 ++++++++++++++++++++++++++++++++++------------ www/dexpisvg.xslt | 4 + 2 files changed, 185 insertions(+), 65 deletions(-) diff --git a/www/dexpi.html b/www/dexpi.html index 5213b8e..19d9b51 100644 --- a/www/dexpi.html +++ b/www/dexpi.html @@ -12,31 +12,45 @@ - PV4712.02 - - + + PV4712.02 + + + + F.C. - F.C. - F.C. - TV4750.03 + + F.C. + + + TV4750.03 + - F.O. + + F.O. + - MNb 47121 75HB13 80 + + MNb 47121 75HB13 80 + - MNb 47122 75HB13 80 + + MNb 47122 75HB13 80 + - MNb 47123 75HB13 80 + + MNb 47123 75HB13 80 + @@ -45,43 +59,61 @@ - MNc 47124 75HB13 80 + + MNc 47124 75HB13 80 + - 66KL21-80 + + 66KL21-80 + - 75SA21-80 + + 75SA21-80 + - 80/50 + + 80/50 + - 73KH12-50 + + 73KH12-50 + - MNc 47125 73HG12 25 + + MNc 47125 73HG12 25 + - SV 104.01 + + SV 104.01 + - MNc 47125 75HB13 50 + + MNc 47125 75HB13 50 + - MNc 47126 75HB13 50 + + MNc 47126 75HB13 50 + @@ -89,7 +121,9 @@ - 73KH12-25 + + 73KH12-25 + @@ -102,13 +136,17 @@ - 73KH12-25 + + 73KH12-25 + - 73KH12-50 + + 73KH12-50 + @@ -122,7 +160,9 @@ - 73KH12-25 + + 73KH12-25 + @@ -132,9 +172,13 @@ - MNc 47127 75HB13 50 Q 80 + + MNc 47127 75HB13 50 Q 80 + - Q80 + + Q80 + @@ -143,28 +187,36 @@ - WKa 47130 75HB13 50 + + WKa 47130 75HB13 50 + - WKb 47131 75HB13 50 + + WKb 47131 75HB13 50 + - QSa 47140 75HB13 50 Q 80 + + QSa 47140 75HB13 50 Q 80 + - QSb 47141 75HB13 50 Q 80 + + QSb 47141 75HB13 50 Q 80 + @@ -173,77 +225,139 @@ - PI + + PI + - PICSA + + PICSA + - HS + + HS + - TICSA + + TICSA + - H1007 - Ident + + H1007 + + + Ident + - N1 + + N1 + - N2 + + N2 + - N3 + + N3 + - N4 + + N4 + - H1008 - Ident + + H1008 + + + Ident + - N1 + + N1 + - N2 + + N2 + - N3 + + N3 + - N4 + + N4 + - P4711 - Ident + + P4711 + + + Ident + - N1 + + N1 + - N2 + + N2 + - P4712 - Ident + + P4712 + + + Ident + - N1 + + N1 + - href="https://www.example.com"> - + + N2 + - N2 - + T4750 - Ident + + Ident + - N1 + + N1 + - N2 + + N2 + - N3 + + N3 + - N5 + + N5 + - N6 + + N6 + - N7 + + N7 + - N8 + + N8 + @@ -286,7 +400,9 @@ - APPROVED BY + + APPROVED BY + diff --git a/www/dexpisvg.xslt b/www/dexpisvg.xslt index 38d2771..1b07719 100644 --- a/www/dexpisvg.xslt +++ b/www/dexpisvg.xslt @@ -137,6 +137,8 @@ + + @@ -197,11 +199,13 @@ + + From 54566daf4133c4742bd6e9d11f211a9c2dbf77b3 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Mon, 2 Sep 2024 23:09:43 +0200 Subject: [PATCH 06/16] update html output --- www/dexpi.html | 123 +++++++++++++++++++++++++------------------------ 1 file changed, 62 insertions(+), 61 deletions(-) diff --git a/www/dexpi.html b/www/dexpi.html index 19d9b51..e8acf46 100644 --- a/www/dexpi.html +++ b/www/dexpi.html @@ -12,26 +12,26 @@ - + PV4712.02 - + F.C. - + F.C. - + TV4750.03 - + F.O. - + MNb 47121 75HB13 80 @@ -40,7 +40,7 @@ - + MNb 47122 75HB13 80 @@ -48,7 +48,7 @@ - + MNb 47123 75HB13 80 @@ -59,50 +59,50 @@ - + MNc 47124 75HB13 80 - + 66KL21-80 - + 75SA21-80 - + 80/50 - + 73KH12-50 - + MNc 47125 73HG12 25 - + SV 104.01 - + MNc 47125 75HB13 50 @@ -111,7 +111,7 @@ - + MNc 47126 75HB13 50 @@ -121,7 +121,7 @@ - + 73KH12-25 @@ -136,7 +136,7 @@ - + 73KH12-25 @@ -144,7 +144,7 @@ - + 73KH12-50 @@ -160,7 +160,7 @@ - + 73KH12-25 @@ -172,11 +172,11 @@ - + MNc 47127 75HB13 50 Q 80 - + Q80 @@ -187,7 +187,7 @@ - + WKa 47130 75HB13 50 @@ -196,7 +196,7 @@ - + WKb 47131 75HB13 50 @@ -205,7 +205,7 @@ - + QSa 47140 75HB13 50 Q 80 @@ -214,7 +214,7 @@ - + QSb 47141 75HB13 50 Q 80 @@ -225,137 +225,137 @@ - + PI - + PICSA - + HS - + TICSA - + H1007 - + Ident - + N1 - + N2 - + N3 - + N4 - + H1008 - + Ident - + N1 - + N2 - + N3 - + N4 - + P4711 - + Ident - + N1 - + N2 - + P4712 - + Ident - + N1 - + N2 - + T4750 - + Ident - + N1 - + N2 - + N3 - + N5 - + N6 - + N7 - + N8 @@ -400,7 +400,7 @@ - + APPROVED BY @@ -529,5 +529,6 @@ + \ No newline at end of file From d6538dfc07db891aa5a18f98b91728adbd863812 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Mon, 2 Sep 2024 23:10:06 +0200 Subject: [PATCH 07/16] update js html --- www/dexpisvg.xslt | 2 +- www/script.js | 43 +++++++++++++++++++++++++++++++++++++++++++ www/style.css | 13 +++++++++++-- 3 files changed, 55 insertions(+), 3 deletions(-) create mode 100644 www/script.js diff --git a/www/dexpisvg.xslt b/www/dexpisvg.xslt index 1b07719..c32dc76 100644 --- a/www/dexpisvg.xslt +++ b/www/dexpisvg.xslt @@ -138,7 +138,7 @@ - + diff --git a/www/script.js b/www/script.js new file mode 100644 index 0000000..bd7772a --- /dev/null +++ b/www/script.js @@ -0,0 +1,43 @@ +var nodes = document.querySelectorAll(".node"); + +document.addEventListener("keyup", (event) => { + if (event.key === "Enter") { + var internalNodes = document.querySelectorAll('.internal'); + var boundaryNodes = document.querySelectorAll('.boundary'); + } + if(internalNodes.length == 1 && boundaryNodes.length >=2) { + // Log IDs of 'internal' nodes + internalNodes.forEach(node => { console.log(`internal ${node.id}`); }); + // Log IDs of 'boundary' nodes + boundaryNodes.forEach(node => { console.log(`boundary ${node.id}`); }); + } +}); + +nodes.forEach(function(node) { + node.addEventListener('click', () => { + if (node.classList.contains('boundary')) { + node.classList.remove('boundary'); + console.log("Remove boundary"); + } else { + node.classList.add('boundary'); + if(node.classList.contains('internal')){ + node.classList.remove('internal') + } + console.log(`Add ${node.id} to boundary`); + } + }); + + node.addEventListener('contextmenu', () => { + if (node.classList.contains('internal')) { + node.classList.remove('internal'); + console.log("Remove internal node"); + } else { + node.classList.add('internal'); + if(node.classList.contains('boundary')){ + node.classList.remove('boundary') + } + console.log(`Add ${node.id} as internal`); + } + }) +}); + diff --git a/www/style.css b/www/style.css index bcf4add..3dd811c 100644 --- a/www/style.css +++ b/www/style.css @@ -1,7 +1,16 @@ /* ------ style.css ----- */ -svg a:hover text { - fill: #FF0000; +.node:hover text { transition: 0.6s; cursor:pointer; } + +.boundary text { + fill: #FF0000; + transition: 0.6s; +} + +.internal text { + fill: rgb(0, 255, 0); + transition: 0.6s; +} \ No newline at end of file From f2de501b8712635643088f177d54be7dd0b70d41 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Tue, 3 Sep 2024 00:06:54 +0200 Subject: [PATCH 08/16] update dlog --- datalog/interactive_boundary.datalog | 7 +++++++ rdfox/boundaries.rdfox | 2 +- rdfox/dexpi.rdfox | 1 + www/script.js | 25 +++++++++++++++++++++---- 4 files changed, 30 insertions(+), 5 deletions(-) create mode 100644 datalog/interactive_boundary.datalog diff --git a/datalog/interactive_boundary.datalog b/datalog/interactive_boundary.datalog new file mode 100644 index 0000000..8fb9bc2 --- /dev/null +++ b/datalog/interactive_boundary.datalog @@ -0,0 +1,7 @@ +prefix data: + +data:insideBoundary [?new_node] :- + data:insideBoundary [?node], + imf:connectedTo [?node, ?new_node], + dexpi:PipingOrEquipment [?new_node], + FILTER NOT data:endOfBoundary [?node] diff --git a/rdfox/boundaries.rdfox b/rdfox/boundaries.rdfox index d245968..8563270 100644 --- a/rdfox/boundaries.rdfox +++ b/rdfox/boundaries.rdfox @@ -8,7 +8,7 @@ prefix rdf: prefix schema: prefix commonlib: prefix dexpi: -prefix asset: +prefix asset: prefix dbo: prefix dexpi: prefix imf: diff --git a/rdfox/dexpi.rdfox b/rdfox/dexpi.rdfox index 9e100c8..e1375f5 100644 --- a/rdfox/dexpi.rdfox +++ b/rdfox/dexpi.rdfox @@ -1,6 +1,7 @@ boundaries.rdfox import ../datalog/boundary.datalog +import ../datalog/interactive_boundary.datalog import +p "../rml/pandid.trig" endpoint start diff --git a/www/script.js b/www/script.js index bd7772a..9ed9829 100644 --- a/www/script.js +++ b/www/script.js @@ -6,10 +6,27 @@ document.addEventListener("keyup", (event) => { var boundaryNodes = document.querySelectorAll('.boundary'); } if(internalNodes.length == 1 && boundaryNodes.length >=2) { - // Log IDs of 'internal' nodes - internalNodes.forEach(node => { console.log(`internal ${node.id}`); }); - // Log IDs of 'boundary' nodes - boundaryNodes.forEach(node => { console.log(`boundary ${node.id}`); }); + let insertQuery = `INSERT DATA { asset:${internalNodes[0].id} a data:insideBoundary . ` + boundaryNodes.forEach(node => { + insertQuery += `asset:${node.id} a data:endOfBoundary . ` + }); + insertQuery += '}' + console.log(insertQuery) + + fetch('http://localhost:12110/datastores/boundaries/sparql', { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: `update=${insertQuery}` + }) + .then(response => response.text()) + .then(data => { + console.log(data); + }) + .catch(error => { + console.error('Error:', error); + }); } }); From 358aaf029f0485bc016e2bb26d7f479e3416a9fe Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Tue, 3 Sep 2024 08:56:36 +0200 Subject: [PATCH 09/16] fix rule --- .gitignore | 4 +++- datalog/interactive_boundary.datalog | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 44cec58..440c75b 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,6 @@ www/C03V04.svg client/Boundaries/Dexpi2Svg/bin client/Boundaries/Dexpi2Svg/obj client/Boundaries/Boundaries/bin -client/Boundaries/Boundaries/obj \ No newline at end of file +client/Boundaries/Boundaries/obj +client/Boundaries/TestBoundaries/obj +client/Boundaries/TestBoundaries/bin \ No newline at end of file diff --git a/datalog/interactive_boundary.datalog b/datalog/interactive_boundary.datalog index 8fb9bc2..b1ebd01 100644 --- a/datalog/interactive_boundary.datalog +++ b/datalog/interactive_boundary.datalog @@ -4,4 +4,4 @@ data:insideBoundary [?new_node] :- data:insideBoundary [?node], imf:connectedTo [?node, ?new_node], dexpi:PipingOrEquipment [?new_node], - FILTER NOT data:endOfBoundary [?node] + NOT data:endOfBoundary [?node]. From d3738396faf8db434c57eb18d7ddda9f362ee53b Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Tue, 3 Sep 2024 10:58:53 +0200 Subject: [PATCH 10/16] fix prefix error --- datalog/interactive_boundary.datalog | 2 +- rdfox/boundaries.rdfox | 2 -- rml/attributes-map.rml.ttl | 2 +- rml/connection-points.map.ttl | 2 +- rml/element-map.rml.ttl | 2 +- rml/equipment-map.rml..ttl | 2 +- rml/nozzlemap.rml..ttl | 2 +- rml/piping-network-component-map.rml..ttl | 2 +- rml/piping-network-segment-map.rml.ttl | 2 +- 9 files changed, 8 insertions(+), 10 deletions(-) diff --git a/datalog/interactive_boundary.datalog b/datalog/interactive_boundary.datalog index b1ebd01..413a03f 100644 --- a/datalog/interactive_boundary.datalog +++ b/datalog/interactive_boundary.datalog @@ -4,4 +4,4 @@ data:insideBoundary [?new_node] :- data:insideBoundary [?node], imf:connectedTo [?node, ?new_node], dexpi:PipingOrEquipment [?new_node], - NOT data:endOfBoundary [?node]. + NOT data:boundary [?node]. diff --git a/rdfox/boundaries.rdfox b/rdfox/boundaries.rdfox index 8563270..b2fb8f1 100644 --- a/rdfox/boundaries.rdfox +++ b/rdfox/boundaries.rdfox @@ -10,11 +10,9 @@ prefix commonlib: prefix dexpi: prefix asset: prefix dbo: -prefix dexpi: prefix imf: prefix data: - import > asset:axioms ../owl/dexpi.ttl import > asset:axioms ../owl/imf-ontology.owl.ttl importaxioms asset:axioms diff --git a/rml/attributes-map.rml.ttl b/rml/attributes-map.rml.ttl index 97a7409..330f5aa 100644 --- a/rml/attributes-map.rml.ttl +++ b/rml/attributes-map.rml.ttl @@ -6,7 +6,7 @@ @prefix schema: . @prefix commonlib: . @prefix dexpi: . -@prefix asset: . +@prefix asset: . @prefix dbo: . @prefix imf: . @prefix owl: . diff --git a/rml/connection-points.map.ttl b/rml/connection-points.map.ttl index 6414d41..ff1ca45 100644 --- a/rml/connection-points.map.ttl +++ b/rml/connection-points.map.ttl @@ -6,7 +6,7 @@ @prefix schema: . @prefix commonlib: . @prefix dexpi: . -@prefix asset: . +@prefix asset: . @prefix dbo: . @prefix imf: . diff --git a/rml/element-map.rml.ttl b/rml/element-map.rml.ttl index 4aff8df..fe0fd8c 100644 --- a/rml/element-map.rml.ttl +++ b/rml/element-map.rml.ttl @@ -6,7 +6,7 @@ @prefix schema: . @prefix commonlib: . @prefix dexpi: . -@prefix asset: . +@prefix asset: . @prefix dbo: . @prefix imf: . diff --git a/rml/equipment-map.rml..ttl b/rml/equipment-map.rml..ttl index c79825c..aceba18 100644 --- a/rml/equipment-map.rml..ttl +++ b/rml/equipment-map.rml..ttl @@ -6,7 +6,7 @@ @prefix schema: . @prefix commonlib: . @prefix dexpi: . -@prefix asset: . +@prefix asset: . @prefix dbo: . @prefix imf: . diff --git a/rml/nozzlemap.rml..ttl b/rml/nozzlemap.rml..ttl index 6cacdca..8662f15 100644 --- a/rml/nozzlemap.rml..ttl +++ b/rml/nozzlemap.rml..ttl @@ -6,7 +6,7 @@ @prefix schema: . @prefix commonlib: . @prefix dexpi: . -@prefix asset: . +@prefix asset: . @prefix dbo: . @prefix imf: . diff --git a/rml/piping-network-component-map.rml..ttl b/rml/piping-network-component-map.rml..ttl index df53042..978d3dd 100644 --- a/rml/piping-network-component-map.rml..ttl +++ b/rml/piping-network-component-map.rml..ttl @@ -6,7 +6,7 @@ @prefix schema: . @prefix commonlib: . @prefix dexpi: . -@prefix asset: . +@prefix asset: . @prefix dbo: . @prefix imf: . diff --git a/rml/piping-network-segment-map.rml.ttl b/rml/piping-network-segment-map.rml.ttl index ecaeea0..4ee0ea5 100644 --- a/rml/piping-network-segment-map.rml.ttl +++ b/rml/piping-network-segment-map.rml.ttl @@ -6,7 +6,7 @@ @prefix schema: . @prefix commonlib: . @prefix dexpi: . -@prefix asset: . +@prefix asset: . @prefix dbo: . @prefix imf: . From 06726b76876a18bf63be976effa676e92b4d4384 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Tue, 3 Sep 2024 10:59:20 +0200 Subject: [PATCH 11/16] upate prefix, create in xslt --- client/Boundaries/Dexpi2Svg/output.svg | 519 +++++++++++++++++++++++++ www/dexpi.html | 123 +++--- www/dexpisvg.xslt | 2 +- www/script.js | 5 +- www/style.css | 2 +- 5 files changed, 585 insertions(+), 66 deletions(-) create mode 100644 client/Boundaries/Dexpi2Svg/output.svg diff --git a/client/Boundaries/Dexpi2Svg/output.svg b/client/Boundaries/Dexpi2Svg/output.svg new file mode 100644 index 0000000..a4dc472 --- /dev/null +++ b/client/Boundaries/Dexpi2Svg/output.svg @@ -0,0 +1,519 @@ + + + + + PV4712.02 + + + + F.C. + + + + F.C. + + + TV4750.03 + + + + F.O. + + + + MNb 47121 75HB13 80 + + + + + + + + + MNb 47122 75HB13 80 + + + + + + + + MNb 47123 75HB13 80 + + + + + + + + + + + MNc 47124 75HB13 80 + + + + + + 66KL21-80 + + + + + 75SA21-80 + + + + + + + 80/50 + + + + + + + 73KH12-50 + + + + + + + MNc 47125 73HG12 25 + + + + + + SV 104.01 + + + + + MNc 47125 75HB13 50 + + + + + + + + + MNc 47126 75HB13 50 + + + + + + + + + + 73KH12-25 + + + + + + + + + + + + + + + 73KH12-25 + + + + + + + + 73KH12-50 + + + + + + + + + + + + + + + + 73KH12-25 + + + + + + + + + + + + MNc 47127 75HB13 50 Q 80 + + + + Q80 + + + + + + + + + + + WKa 47130 75HB13 50 + + + + + + + + + WKb 47131 75HB13 50 + + + + + + + + + QSa 47140 75HB13 50 Q 80 + + + + + + + + + QSb 47141 75HB13 50 Q 80 + + + + + + + + + + + PI + + + + + PICSA + + + + + + HS + + + + + TICSA + + + + + + H1007 + + + Ident + + + + N1 + + + + N2 + + + + N3 + + + + N4 + + + + H1008 + + + Ident + + + + N1 + + + + N2 + + + + N3 + + + + N4 + + + + P4711 + + + Ident + + + + N1 + + + + N2 + + + + P4712 + + + Ident + + + + N1 + + + + N2 + + + + + T4750 + + + Ident + + + + N1 + + + + N2 + + + + N3 + + + + N5 + + + + N6 + + + + N7 + + + + N8 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + APPROVED BY + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/www/dexpi.html b/www/dexpi.html index e8acf46..d15c055 100644 --- a/www/dexpi.html +++ b/www/dexpi.html @@ -12,26 +12,26 @@ - + PV4712.02 - + F.C. - + F.C. - + TV4750.03 - + F.O. - + MNb 47121 75HB13 80 @@ -40,7 +40,7 @@ - + MNb 47122 75HB13 80 @@ -48,7 +48,7 @@ - + MNb 47123 75HB13 80 @@ -59,50 +59,50 @@ - + MNc 47124 75HB13 80 - + 66KL21-80 - + 75SA21-80 - + 80/50 - + 73KH12-50 - + MNc 47125 73HG12 25 - + SV 104.01 - + MNc 47125 75HB13 50 @@ -111,7 +111,7 @@ - + MNc 47126 75HB13 50 @@ -121,7 +121,7 @@ - + 73KH12-25 @@ -136,7 +136,7 @@ - + 73KH12-25 @@ -144,7 +144,7 @@ - + 73KH12-50 @@ -160,7 +160,7 @@ - + 73KH12-25 @@ -172,11 +172,11 @@ - + MNc 47127 75HB13 50 Q 80 - + Q80 @@ -187,7 +187,7 @@ - + WKa 47130 75HB13 50 @@ -196,7 +196,7 @@ - + WKb 47131 75HB13 50 @@ -205,7 +205,7 @@ - + QSa 47140 75HB13 50 Q 80 @@ -214,7 +214,7 @@ - + QSb 47141 75HB13 50 Q 80 @@ -225,137 +225,137 @@ - + PI - + PICSA - + HS - + TICSA - + H1007 - + Ident - + N1 - + N2 - + N3 - + N4 - + H1008 - + Ident - + N1 - + N2 - + N3 - + N4 - + P4711 - + Ident - + N1 - + N2 - + P4712 - + Ident - + N1 - + N2 - + T4750 - + Ident - + N1 - + N2 - + N3 - + N5 - + N6 - + N7 - + N8 @@ -400,7 +400,7 @@ - + APPROVED BY @@ -528,7 +528,6 @@ - \ No newline at end of file diff --git a/www/dexpisvg.xslt b/www/dexpisvg.xslt index c32dc76..f7d4da8 100644 --- a/www/dexpisvg.xslt +++ b/www/dexpisvg.xslt @@ -138,7 +138,7 @@ - + diff --git a/www/script.js b/www/script.js index 9ed9829..b9c8a6f 100644 --- a/www/script.js +++ b/www/script.js @@ -6,11 +6,12 @@ document.addEventListener("keyup", (event) => { var boundaryNodes = document.querySelectorAll('.boundary'); } if(internalNodes.length == 1 && boundaryNodes.length >=2) { - let insertQuery = `INSERT DATA { asset:${internalNodes[0].id} a data:insideBoundary . ` + let insertQuery = `INSERT DATA { <${internalNodes[0].id}> a data:insideBoundary . ` boundaryNodes.forEach(node => { - insertQuery += `asset:${node.id} a data:endOfBoundary . ` + insertQuery += `<${node.id}> a data:boundary . ` }); insertQuery += '}' + console.log(insertQuery) fetch('http://localhost:12110/datastores/boundaries/sparql', { diff --git a/www/style.css b/www/style.css index 3dd811c..cb02847 100644 --- a/www/style.css +++ b/www/style.css @@ -13,4 +13,4 @@ .internal text { fill: rgb(0, 255, 0); transition: 0.6s; -} \ No newline at end of file +} From cae972dcba1a5845668485d72be86811b44d04d8 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Tue, 3 Sep 2024 13:17:56 +0200 Subject: [PATCH 12/16] add documentation, refactor, delete and insert on click --- www/script.js | 90 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 58 insertions(+), 32 deletions(-) diff --git a/www/script.js b/www/script.js index b9c8a6f..59ad77f 100644 --- a/www/script.js +++ b/www/script.js @@ -2,60 +2,86 @@ var nodes = document.querySelectorAll(".node"); document.addEventListener("keyup", (event) => { if (event.key === "Enter") { - var internalNodes = document.querySelectorAll('.internal'); - var boundaryNodes = document.querySelectorAll('.boundary'); - } - if(internalNodes.length == 1 && boundaryNodes.length >=2) { - let insertQuery = `INSERT DATA { <${internalNodes[0].id}> a data:insideBoundary . ` - boundaryNodes.forEach(node => { - insertQuery += `<${node.id}> a data:boundary . ` - }); - insertQuery += '}' - - console.log(insertQuery) - - fetch('http://localhost:12110/datastores/boundaries/sparql', { - method: 'POST', - headers: { - 'Content-Type': 'application/x-www-form-urlencoded', - }, - body: `update=${insertQuery}` - }) - .then(response => response.text()) - .then(data => { - console.log(data); - }) - .catch(error => { - console.error('Error:', error); - }); + //TODO + console.log("Enter pressed, getting sparql result from rdfox") } }); +/** + * Left clicking is used to select or deselect nodes as boundries: + * 1) If the node is not a member of the boundary class: + * - Add the node to the boundary class to indicate that it is selected + * - Update rdfox with the following triple :nodeId a :boundary . + * 2) If the node is a member of the boundary class: + * - Remove the node from the boundary class to indicate that it is deselected + * - Update rdfox, delete the following triple :nodeId a :boundary . + * 3) If the node is not a member of the boundary class, but is a member of the internal class: + * - Add the node to the boundary class, and remove it from the internal class. + * * - Update rdfox, insert the following triple :nodeId a :boundary . + * - Update rdfox, delete the following triple :nodeId a :insideBoundary . + */ nodes.forEach(function(node) { node.addEventListener('click', () => { if (node.classList.contains('boundary')) { node.classList.remove('boundary'); - console.log("Remove boundary"); + let deleteSparql = `DELETE DATA {<${node.id}> a data:boundary . }`; + updateTripleStore(deleteSparql); } else { node.classList.add('boundary'); + let insertSparql = `INSERT DATA { <${node.id}> a data:boundary . }`; + updateTripleStore(insertSparql); if(node.classList.contains('internal')){ - node.classList.remove('internal') + node.classList.remove('internal'); + let deleteSparql = `DELETE DATA { <${node.id}> a data:insideBoundary . }`; + updateTripleStore(deleteSparql); } - console.log(`Add ${node.id} to boundary`); } }); +/** + * Right clicking is used to select or deselect a node as internal: + * 1) If the node is not a member of the internal class: + * - Add the node to the internal class to indicate that it is selected + * - Update rdfox with the following triple :nodeId a :insideBoundary . + * 2) If the node is a member of the internal class: + * - Remove the node from the internal class to indicate that it is deselected + * - Update rdfox, delete the following triple :nodeId a :insideBoundary . + * 3) If the node is not a member of the internal class, but is a member of the boundary class: + * - Add the node to the internal class, and remove it from the boundary class. + * * - Update rdfox, insert the following triple :nodeId a :insideBoundary . + * - Update rdfox, delete the following triple :nodeId a :boundary . + */ node.addEventListener('contextmenu', () => { if (node.classList.contains('internal')) { node.classList.remove('internal'); - console.log("Remove internal node"); + let deleteSparql = `DELETE DATA {<${node.id}> a data:insideBoundary . }`; + updateTripleStore(deleteSparql) } else { node.classList.add('internal'); + let insertSparql = `INSERT DATA { <${node.id}> a data:insideBoundary . }`; + updateTripleStore(insertSparql); if(node.classList.contains('boundary')){ - node.classList.remove('boundary') + node.classList.remove('boundary'); + let deleteSparql = `DELETE DATA {<${node.id}> a data:boundary . }`; + updateTripleStore(deleteSparql); } - console.log(`Add ${node.id} as internal`); } }) }); +function updateTripleStore(sparql) { + fetch('http://localhost:12110/datastores/boundaries/sparql', { + method: 'POST', + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + body: `update=${sparql}` + }) + .then(response => response.text()) + .then(data => { + console.log(data); + }) + .catch(error => { + console.error('Error:', error); + }); +} \ No newline at end of file From b992658f35345f77a1eaa00d318163516857b465 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Tue, 3 Sep 2024 15:10:26 +0200 Subject: [PATCH 13/16] trial and error --- rdfox/boundaries.rdfox | 1 + rdfox/connected.rdfox | 1 + rdfox/dexpi.rdfox | 2 -- www/dexpi.html | 4 +++- www/script.js | 24 ++++++++++++++++++++++-- www/style.css | 6 +++++- 6 files changed, 32 insertions(+), 6 deletions(-) diff --git a/rdfox/boundaries.rdfox b/rdfox/boundaries.rdfox index b2fb8f1..a8bb660 100644 --- a/rdfox/boundaries.rdfox +++ b/rdfox/boundaries.rdfox @@ -19,4 +19,5 @@ importaxioms asset:axioms import > schema:shacl ../shacl/imf-dexpi.shacl.ttl commitproc set commit-procedure.sparql +set access-control-allow-origin * endpoint start diff --git a/rdfox/connected.rdfox b/rdfox/connected.rdfox index bfbd84d..5adeeca 100644 --- a/rdfox/connected.rdfox +++ b/rdfox/connected.rdfox @@ -3,6 +3,7 @@ boundaries.rdfox import ../datalog/surrounding.datalog import +p "../rml/pandid.trig" +set access-control-allow-origin * endpoint start set output out diff --git a/rdfox/dexpi.rdfox b/rdfox/dexpi.rdfox index e1375f5..9187004 100644 --- a/rdfox/dexpi.rdfox +++ b/rdfox/dexpi.rdfox @@ -4,7 +4,5 @@ import ../datalog/boundary.datalog import ../datalog/interactive_boundary.datalog import +p "../rml/pandid.trig" -endpoint start - set output out select * where {?s a data:insideBoundaryX} \ No newline at end of file diff --git a/www/dexpi.html b/www/dexpi.html index d15c055..a1ec54a 100644 --- a/www/dexpi.html +++ b/www/dexpi.html @@ -528,6 +528,8 @@ - + + \ No newline at end of file diff --git a/www/script.js b/www/script.js index 59ad77f..0414f07 100644 --- a/www/script.js +++ b/www/script.js @@ -2,8 +2,11 @@ var nodes = document.querySelectorAll(".node"); document.addEventListener("keyup", (event) => { if (event.key === "Enter") { - //TODO - console.log("Enter pressed, getting sparql result from rdfox") + console.log("enter pressed") + let query = 'SELECT ?node WHERE{?node a data:insideBoundary .}' + var result = queryTripleStore(query) + console.log(result.payload) + console.log("tried to log") } }); @@ -84,4 +87,21 @@ function updateTripleStore(sparql) { .catch(error => { console.error('Error:', error); }); +} + +function queryTripleStore(sparql) { + var encoded = encodeURI(sparql) + fetch(`http://localhost:12110/datastores/boundaries/sparql?query=${encoded}`, { + method: 'GET', + }) + .then(response => { + console.log("trying to log reposnse") + console.log(response.text())}) + .then(data => { + console.log("trying to log response") + console.log(data); + }) + .catch(error => { + console.error('Error:', error); + }); } \ No newline at end of file diff --git a/www/style.css b/www/style.css index cb02847..0e0b393 100644 --- a/www/style.css +++ b/www/style.css @@ -11,6 +11,10 @@ } .internal text { - fill: rgb(0, 255, 0); + fill: rgb(234, 255, 0); transition: 0.6s; } + +.package text { + fill: rgb(5, 109, 5) +} From b705edc5d7e3eea427ace22b6cd3718f1ff01de1 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Tue, 3 Sep 2024 23:39:39 +0200 Subject: [PATCH 14/16] fix issue with cors --- rdfox/boundaries.rdfox | 2 +- rdfox/endpoint.params | 2 ++ www/script.js | 21 ++++++++------------- 3 files changed, 11 insertions(+), 14 deletions(-) create mode 100644 rdfox/endpoint.params diff --git a/rdfox/boundaries.rdfox b/rdfox/boundaries.rdfox index a8bb660..cd0a161 100644 --- a/rdfox/boundaries.rdfox +++ b/rdfox/boundaries.rdfox @@ -19,5 +19,5 @@ importaxioms asset:axioms import > schema:shacl ../shacl/imf-dexpi.shacl.ttl commitproc set commit-procedure.sparql -set access-control-allow-origin * +set endpoint.access-control-allow-origin * endpoint start diff --git a/rdfox/endpoint.params b/rdfox/endpoint.params new file mode 100644 index 0000000..f97de1e --- /dev/null +++ b/rdfox/endpoint.params @@ -0,0 +1,2 @@ +#Enable cors +access-control-allow-origin * \ No newline at end of file diff --git a/www/script.js b/www/script.js index 0414f07..5a1969d 100644 --- a/www/script.js +++ b/www/script.js @@ -4,9 +4,7 @@ document.addEventListener("keyup", (event) => { if (event.key === "Enter") { console.log("enter pressed") let query = 'SELECT ?node WHERE{?node a data:insideBoundary .}' - var result = queryTripleStore(query) - console.log(result.payload) - console.log("tried to log") + result = queryTripleStore(query) } }); @@ -94,14 +92,11 @@ function queryTripleStore(sparql) { fetch(`http://localhost:12110/datastores/boundaries/sparql?query=${encoded}`, { method: 'GET', }) - .then(response => { - console.log("trying to log reposnse") - console.log(response.text())}) - .then(data => { - console.log("trying to log response") - console.log(data); - }) - .catch(error => { - console.error('Error:', error); - }); + .then(response => response.text()) + .then(data => { + console.log(data); + }) + .catch(error => { + console.error('Error:', error); + }); } \ No newline at end of file From 074c375cbd643c5ae72af5707dc722cebea9f71d Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Wed, 4 Sep 2024 09:37:44 +0200 Subject: [PATCH 15/16] smol readme --- www/README.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 www/README.md diff --git a/www/README.md b/www/README.md new file mode 100644 index 0000000..b78bd2a --- /dev/null +++ b/www/README.md @@ -0,0 +1,7 @@ +# Select boundary in browser +1) Run the dexpi.rdfox script, the documentation for this script is found [here](../rdfox/README.md) +2) Open the dexpi.html file in a browser +3) Select the boundary points and an internal component +- Right click to select or deselect the internal component +- Left click to select or deselect boundary nodes +4) Hit enter to query RDFox for the boundary From 91435c4a4ec1ef0527176daa4a277819606a5055 Mon Sep 17 00:00:00 2001 From: "henriette.rebnor" Date: Wed, 4 Sep 2024 09:40:39 +0200 Subject: [PATCH 16/16] update readme --- client/Boundaries/Dexpi2Svg/output.svg | 519 ------------------------- www/README.md | 2 +- 2 files changed, 1 insertion(+), 520 deletions(-) delete mode 100644 client/Boundaries/Dexpi2Svg/output.svg diff --git a/client/Boundaries/Dexpi2Svg/output.svg b/client/Boundaries/Dexpi2Svg/output.svg deleted file mode 100644 index a4dc472..0000000 --- a/client/Boundaries/Dexpi2Svg/output.svg +++ /dev/null @@ -1,519 +0,0 @@ - - - - - PV4712.02 - - - - F.C. - - - - F.C. - - - TV4750.03 - - - - F.O. - - - - MNb 47121 75HB13 80 - - - - - - - - - MNb 47122 75HB13 80 - - - - - - - - MNb 47123 75HB13 80 - - - - - - - - - - - MNc 47124 75HB13 80 - - - - - - 66KL21-80 - - - - - 75SA21-80 - - - - - - - 80/50 - - - - - - - 73KH12-50 - - - - - - - MNc 47125 73HG12 25 - - - - - - SV 104.01 - - - - - MNc 47125 75HB13 50 - - - - - - - - - MNc 47126 75HB13 50 - - - - - - - - - - 73KH12-25 - - - - - - - - - - - - - - - 73KH12-25 - - - - - - - - 73KH12-50 - - - - - - - - - - - - - - - - 73KH12-25 - - - - - - - - - - - - MNc 47127 75HB13 50 Q 80 - - - - Q80 - - - - - - - - - - - WKa 47130 75HB13 50 - - - - - - - - - WKb 47131 75HB13 50 - - - - - - - - - QSa 47140 75HB13 50 Q 80 - - - - - - - - - QSb 47141 75HB13 50 Q 80 - - - - - - - - - - - PI - - - - - PICSA - - - - - - HS - - - - - TICSA - - - - - - H1007 - - - Ident - - - - N1 - - - - N2 - - - - N3 - - - - N4 - - - - H1008 - - - Ident - - - - N1 - - - - N2 - - - - N3 - - - - N4 - - - - P4711 - - - Ident - - - - N1 - - - - N2 - - - - P4712 - - - Ident - - - - N1 - - - - N2 - - - - - T4750 - - - Ident - - - - N1 - - - - N2 - - - - N3 - - - - N5 - - - - N6 - - - - N7 - - - - N8 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - APPROVED BY - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/www/README.md b/www/README.md index b78bd2a..c25f80c 100644 --- a/www/README.md +++ b/www/README.md @@ -4,4 +4,4 @@ 3) Select the boundary points and an internal component - Right click to select or deselect the internal component - Left click to select or deselect boundary nodes -4) Hit enter to query RDFox for the boundary +4) Hit enter to query RDFox for the boundary - the output of the query can be found in the logs. \ No newline at end of file