activity-pub-poc/tmp/org/domaindrivenarchitecture/activity_pub_poc/parser.clj

45 lines
1.2 KiB
Clojure

(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]
(str/join "\n"
(remove
#(or (re-matches #"^#.*" %) (re-matches #"" %))
(str/split-lines
(slurp resource-file)))))
; find definitions
; 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
(defn find-definitions [string-input]
(str/split string-input #"\.\n|\.$"))
; 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
; prefix:Type
; ]}]}
(defn to-map-from-def [string-input])