2023-06-21 12:07:36 +00:00
|
|
|
(ns org.domaindrivenarchitecture.activity-pub-poc.parser
|
|
|
|
(:require [org.domaindrivenarchitecture.activity-pub-poc.common :as cm]
|
|
|
|
[clojure.string :as str]))
|
|
|
|
|
|
|
|
(def activitystreams-turtle (slurp cm/activitystreams-ttl))
|
|
|
|
|
|
|
|
; pre-format
|
|
|
|
(defn delete-comments-and-newlines [resource-file]
|
2023-06-22 09:57:17 +00:00
|
|
|
(str/join "\n"
|
2023-06-21 12:07:36 +00:00
|
|
|
(remove
|
|
|
|
#(or (re-matches #"^#.*" %) (re-matches #"" %))
|
|
|
|
(str/split-lines
|
|
|
|
(slurp resource-file)))))
|
|
|
|
|
|
|
|
; find definitions
|
2023-06-22 09:57:17 +00:00
|
|
|
; find definitions algo
|
|
|
|
; walk through list
|
|
|
|
; check the current element
|
|
|
|
; does it have a dot at the end?
|
|
|
|
; yes
|
|
|
|
; put it in the current list
|
|
|
|
; if this does not exist, create it
|
|
|
|
; the next element goes into a new list
|
|
|
|
;
|
|
|
|
; no
|
|
|
|
; put it in the current list
|
2023-06-21 12:07:36 +00:00
|
|
|
(defn find-definitions [string-input]
|
2023-06-22 09:57:17 +00:00
|
|
|
(str/split string-input #"\.\n|\.$"))
|
2023-06-21 12:07:36 +00:00
|
|
|
|
|
|
|
|
|
|
|
; make list of vectors/map from well known input-string
|
|
|
|
; distinguish iri,keyword and prefix
|
|
|
|
; if keyword make a triple
|
|
|
|
; if iri or prefix make a map:
|
|
|
|
;
|
|
|
|
;{{prefix:xyz prefix:zab}
|
|
|
|
; [{prefix:bla "possibly string"@someKeyword}
|
|
|
|
; {prefix:foo prefix:orSthElse}
|
|
|
|
; {prefix:range ; range muss sich liebevoll angeschaut werden
|
|
|
|
; [
|
|
|
|
; prefix:Type
|
2023-06-21 15:07:56 +00:00
|
|
|
; prefix:Type
|
2023-06-21 12:07:36 +00:00
|
|
|
; ]}]}
|
|
|
|
(defn to-map-from-def [string-input])
|
|
|
|
|