Compare commits

...

4 commits

Author SHA1 Message Date
c5f800715f Update minimal base example 2023-06-22 11:58:12 +02:00
e0f9af5575 Update minimal example 2023-06-22 11:57:51 +02:00
f8482f523f Update test 2023-06-22 11:57:30 +02:00
a159ed93ab Update regex 2023-06-22 11:57:17 +02:00
4 changed files with 83 additions and 15 deletions

View file

@ -6,15 +6,26 @@
; pre-format
(defn delete-comments-and-newlines [resource-file]
(apply str
(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 #" \.")) ;ToDo this is crap, splits need tbd differently
(str/split string-input #"\.\n|\.$"))
; make list of vectors/map from well known input-string

View file

@ -4,17 +4,19 @@
(def processed (slurp "src/test/resources/deleted_comments_minimal.ttl"))
(def expected-definitions ["@prefix : <http://www.w3.org/ns/activitystreams#>"
"@prefix as: <http://www.w3.org/ns/activitystreams#>"
"@prefix owl: <http://www.w3.org/2002/07/owl#>"
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>"
"@prefix xml: <http://www.w3.org/XML/1998/namespace>"
"@prefix xsd: <http://www.w3.org/2001/XMLSchema#>"
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>"
"@base <http://www.w3.org/ns/activitystreams>"
"<http://www.w3.org/ns/activitystreams#> a owl:Ontology ; rdfs:comment \"Extended Activity Streams 2.0 Vocabulary\"@en ; rdfs:label \"Activity Streams 2.0\"@en ; owl:imports <http://www.w3.org/ns/prov#>"
"rdf:langString a rdfs:Datatype"
"xsd:duration a rdfs:Datatype"])
(def expected-definitions ["@prefix : <http://www.w3.org/ns/activitystreams#> "
"@prefix as: <http://www.w3.org/ns/activitystreams#> "
"@prefix owl: <http://www.w3.org/2002/07/owl#> "
"@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> "
"@prefix xml: <http://www.w3.org/XML/1998/namespace> "
"@prefix xsd: <http://www.w3.org/2001/XMLSchema#> "
"@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> "
"@base <http://www.w3.org/ns/activitystreams> "
"<http://www.w3.org/ns/activitystreams#> a owl:Ontology ;\n rdfs:comment \"Extended Activity Streams 2.0 Vocabulary\"@en ;\n rdfs:label \"Activity Streams 2.0\"@en ;\n owl:imports <http://www.w3.org/ns/prov#> "
"rdf:langString a rdfs:Datatype "
"xsd:duration a rdfs:Datatype "
"as:actor a owl:ObjectProperty ;\n rdfs:label \"actor\"@en ;\n rdfs:domain as:Activity ;\n rdfs:comment \"Subproperty of as:attributedTo that identifies the primary actor\"@en ;\n rdfs:subPropertyOf as:attributedTo ;\n rdfs:range [\n a owl:Class ;\n owl:unionOf (as:Object as:Link)\n ] "
"as:attributedTo a owl:ObjectProperty ;\n rdfs:label \"attributedTo\"@en;\n rdfs:comment \"Identifies an entity to which an object is attributed\"@en;\n rdfs:range [\n a owl:Class ;\n owl:unionOf (as:Object as:Link)\n ] ;\n rdfs:domain [\n a owl:Class ;\n owl:unionOf (as:Object as:Link)\n ] ; "])
(deftest remove-comments-test
(is

View file

@ -1 +1,34 @@
@prefix : <http://www.w3.org/ns/activitystreams#> .@prefix as: <http://www.w3.org/ns/activitystreams#> .@prefix owl: <http://www.w3.org/2002/07/owl#> .@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .@prefix xml: <http://www.w3.org/XML/1998/namespace> .@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .@base <http://www.w3.org/ns/activitystreams> .<http://www.w3.org/ns/activitystreams#> a owl:Ontology ; rdfs:comment "Extended Activity Streams 2.0 Vocabulary"@en ; rdfs:label "Activity Streams 2.0"@en ; owl:imports <http://www.w3.org/ns/prov#> .rdf:langString a rdfs:Datatype .xsd:duration a rdfs:Datatype .
@prefix : <http://www.w3.org/ns/activitystreams#> .
@prefix as: <http://www.w3.org/ns/activitystreams#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@base <http://www.w3.org/ns/activitystreams> .
<http://www.w3.org/ns/activitystreams#> a owl:Ontology ;
rdfs:comment "Extended Activity Streams 2.0 Vocabulary"@en ;
rdfs:label "Activity Streams 2.0"@en ;
owl:imports <http://www.w3.org/ns/prov#> .
rdf:langString a rdfs:Datatype .
xsd:duration a rdfs:Datatype .
as:actor a owl:ObjectProperty ;
rdfs:label "actor"@en ;
rdfs:domain as:Activity ;
rdfs:comment "Subproperty of as:attributedTo that identifies the primary actor"@en ;
rdfs:subPropertyOf as:attributedTo ;
rdfs:range [
a owl:Class ;
owl:unionOf (as:Object as:Link)
] .
as:attributedTo a owl:ObjectProperty ;
rdfs:label "attributedTo"@en;
rdfs:comment "Identifies an entity to which an object is attributed"@en;
rdfs:range [
a owl:Class ;
owl:unionOf (as:Object as:Link)
] ;
rdfs:domain [
a owl:Class ;
owl:unionOf (as:Object as:Link)
] ; .

View file

@ -27,4 +27,26 @@ xsd:duration a rdfs:Datatype .
#
# Object Properties
#
#################################################################
#################################################################
as:actor a owl:ObjectProperty ;
rdfs:label "actor"@en ;
rdfs:domain as:Activity ;
rdfs:comment "Subproperty of as:attributedTo that identifies the primary actor"@en ;
rdfs:subPropertyOf as:attributedTo ;
rdfs:range [
a owl:Class ;
owl:unionOf (as:Object as:Link)
] .
as:attributedTo a owl:ObjectProperty ;
rdfs:label "attributedTo"@en;
rdfs:comment "Identifies an entity to which an object is attributed"@en;
rdfs:range [
a owl:Class ;
owl:unionOf (as:Object as:Link)
] ;
rdfs:domain [
a owl:Class ;
owl:unionOf (as:Object as:Link)
] ; .