aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonas Smedegaard <dr@jones.dk>2024-05-19 23:50:49 +0200
committerJonas Smedegaard <dr@jones.dk>2024-06-04 17:35:41 +0200
commitf14cf62a118c9324e7e83749df1e50ab2f3ad265 (patch)
tree9c47929a95e8a48d8658c81aa78adf8438961d63
parent81baf0aa7d414dbdcb70d3d63e691f8de2440432 (diff)
add example knowledge graph windsurfing
-rw-r--r--.gitignore2
-rw-r--r--Makefile22
-rw-r--r--rdf/learning.sdm9
-rw-r--r--rdf/prefixes.ttl31
-rw-r--r--rdf/windsurfing.ttl27
5 files changed, 88 insertions, 3 deletions
diff --git a/.gitignore b/.gitignore
index 50fe115..df48ffd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,3 +8,5 @@ svg-inkscape/
rdf/*.ttl
rdf/*.svg
index.tex
+!rdf/prefixes.ttl
+!rdf/windsurfing.ttl
diff --git a/Makefile b/Makefile
index 04e3426..226e9bf 100644
--- a/Makefile
+++ b/Makefile
@@ -9,6 +9,8 @@ ARTICLES = waste worlding
ONTOLOGIES = learning waste
+GRAPHS = windsurfing
+
PERL_FILES = bin/biblatex-tidy bin/hedgedoc2quarto bin/xmp2rdfxml
TIDY_MARKDOWN = worlding
@@ -147,7 +149,7 @@ $(ARTICLES:%=%/b.tex): %/b.tex:
mv --force $*/index.tex $@
rm --force _site/b.pdf
-rdf/%.svg: rdf/%.sdm
+rdf/%-concepts.svg: rdf/%.sdm
sdml draw --diagram concepts -i $< -f svg -o $@
rdf/%-er.svg: rdf/%.sdm
@@ -159,11 +161,20 @@ rdf/%-uml.svg: rdf/%.sdm
rdf/%.ttl: rdf/%.sdm
sdml convert -i $< -f rdf -o $@ --no-color
+rdf/%.puml: rdf/%.ttl rdf/prefixes.ttl
+ rdfpuml $<
+
+rdf/%.png: rdf/%.puml
+ plantuml -tpng $<
+
+rdf/%.svg: rdf/%.puml
+ plantuml -tsvg $<
+
rdf/%/index.html: rdf/%.ttl
mkdir --parents rdf/$*
ontospy gendocs --type 2 -x -o $(CURDIR)/rdf/$* $<
-$(ONTOLOGIES:%=view-%-concept-diagram): view-%-concept-diagram: rdf/%.svg
+$(ONTOLOGIES:%=view-%-concept-diagram): view-%-concept-diagram: rdf/%-concepts.svg
inkview $<
$(ONTOLOGIES:%=view-%-er-diagram): view-%-er-diagram: rdf/%-er.svg
@@ -175,4 +186,11 @@ $(ONTOLOGIES:%=view-%-uml-diagram): view-%-uml-diagram: rdf/%-uml.svg
$(ONTOLOGIES:%=view-%-rdfs-graf): view-%-rdfs-graf: rdf/%.ttl
rdfs2dot -f turtle $< | xdot -
+#$(ONTOLOGIES:%=view-%-puml-diagram): view-%-puml-diagram: rdf/%.svg
+# inkview $<
+#$(ONTOLOGIES:%=view-%-puml-diagram): view-%-puml-diagram: rdf/%.png
+# imv-wayland $<
+$(GRAPHS:%=view-%-puml-diagram): view-%-puml-diagram: rdf/%.png
+ imv-wayland $<
+
$(ONTOLOGIES:%=render-%-ontology): render-%-ontology: rdf/%/index.html
diff --git a/rdf/learning.sdm b/rdf/learning.sdm
index b466ed3..e3b7026 100644
--- a/rdf/learning.sdm
+++ b/rdf/learning.sdm
@@ -1,6 +1,11 @@
module learning learning <https://thoughtroam.abcdefghijklmnopqrstuvxyzæøå.dk/rdf/> is
- import [ dc skos xsd ]
+ import [
+ dc
+; foaf <http://xmlns.com/foaf/0.1/>
+ skos
+ xsd
+ ]
@skos:prefLabel = "Learning Ontology"@en
@dc:description = "General domain ontology on learning"@en
@@ -25,6 +30,7 @@ module learning learning <https://thoughtroam.abcdefghijklmnopqrstuvxyzæøå.dk
end
entity Learner is
+; @rdf:type = foaf:Person
@skos:description = "Agent subject to a learning process"@en
identity id -> unknown
@@ -46,6 +52,7 @@ module learning learning <https://thoughtroam.abcdefghijklmnopqrstuvxyzæøå.dk
end
entity Educator is
+; @rdf:type = foaf:Person
@skos:description = "Agent aiding a learner towards an objective"@en
@skos:description = "Agent abstractly or concretely guiding a learner towards an objective"@en
; @skos:narrower = Teacher, Instructor, Facilitator, Evaluator
diff --git a/rdf/prefixes.ttl b/rdf/prefixes.ttl
new file mode 100644
index 0000000..11a3a6f
--- /dev/null
+++ b/rdf/prefixes.ttl
@@ -0,0 +1,31 @@
+@base <https://thoughtroam.xn--abcdefghijklmnopqrstuvxyz-0fc0a81c.dk/rdf> .
+@prefix : <#> .
+@prefix ex: <https://thoughtroam.xn--abcdefghijklmnopqrstuvxyz-0fc0a81c.dk/rdf/ex#> .
+@prefix learning: <https://thoughtroam.xn--abcdefghijklmnopqrstuvxyz-0fc0a81c.dk/rdf/> .
+@prefix foaf: <http://xmlns.com/foaf/0.1/> .
+@prefix owl: <http://www.w3.org/2002/07/owl#> .
+@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
+@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
+@prefix sdml: <http://sdml.io/sdml-owl.ttl#> .
+@prefix dc: <http://purl.org/dc/elements/1.1/> .
+@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
+@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
+
+#[] puml:options """
+# hide empty members
+# hide circle
+# left to right direction
+#""".
+
+# TODO: use FoaF ontology
+foaf:Person puml:stereotype "(A,orange)".
+:Learner puml:stereotype "(A,orange)".
+:Educator puml:stereotype "(A,orange)".
+:Objective puml:stereotype "(O,green)".
+
+#<> a puml:Inline.
+#sdml:Member a puml:Inline.
+sdml:hasMember a puml:InlineProperty.
+dc:creator a puml:InlineProperty.
+dc:license a puml:InlineProperty.
+owl:imports a puml:InlineProperty.
diff --git a/rdf/windsurfing.ttl b/rdf/windsurfing.ttl
new file mode 100644
index 0000000..b4bfdba
--- /dev/null
+++ b/rdf/windsurfing.ttl
@@ -0,0 +1,27 @@
+ex:windsurfing a :Objective;
+ rdfs:label "Windsurfing".
+
+ex:ernst a :Learner;
+ rdfs:label "Ernst Schraube";
+ :seeksObjective ex:windsurfing;
+ :learnsCausedBy ex:boredom, ex:sealove;
+ :learnsThrough ex:stand.
+
+ex:stand a :Practice;
+ rdfs:label "standing up";
+ rdfs:desc "trying to just stand on a board in the water";
+ :contributesTo ex:windsurfing, ex:feel_balance.
+
+ex:feel_balance a :Objective;
+ rdfs:label "feel for balance";
+ rdfs:desc "get a feel for the balance".
+
+ex:boredom a :DefensiveReason;
+ rdfs:label "boredom";
+ rdfs:desc "I am bored at the beach and there is nothing else to do.";
+ :causeAction ex:stand.
+
+ex:sealove a :ExpansiveReason;
+ rdfs:label "love for the sea";
+ rdfs:desc "I love the sea and dream about planning across the water.";
+ :causeAction ex:stand.