From 3dd8b96f00f3fa7417ea7abd93c588b5aadbba81 Mon Sep 17 00:00:00 2001 From: Michael Jerger Date: Tue, 20 Jun 2023 09:32:59 +0200 Subject: [PATCH] minor steps --- .../activity_pub_poc/core.clj | 17 +- ...ms-owl.ttl => activitystreams_2.0_owl.ttl} | 2 + .../{rdf-schema.ttl => rdf_schema_1.1.ttl} | 2 + src/main/resources/rdf_syntax_ns_22.ttl | 154 ++++++++++++++++++ 4 files changed, 170 insertions(+), 5 deletions(-) rename src/main/resources/{activitystreams-owl.ttl => activitystreams_2.0_owl.ttl} (99%) rename src/main/resources/{rdf-schema.ttl => rdf_schema_1.1.ttl} (98%) create mode 100644 src/main/resources/rdf_syntax_ns_22.ttl diff --git a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/core.clj b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/core.clj index 05099e7..9c19c52 100644 --- a/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/core.clj +++ b/src/main/clj/org/domaindrivenarchitecture/activity_pub_poc/core.clj @@ -1,6 +1,7 @@ (ns org.domaindrivenarchitecture.activity-pub-poc.core (:require [lambdaisland.souk.activitypub :as ap] [lambdaisland.souk.json-ld :as ld] + [clojure.spec.alpha :as s] [clojure.inspector :as ins] [hato.client :as hato] [clojure.string :as str] @@ -10,14 +11,20 @@ (def like-url "https://www.w3.org/ns/activitystreams#Like") (def name-url "https://www.w3.org/ns/activitystreams#name") -(def context-team (ins/inspect-tree (ld/expand (:body (ld/json-get team-url))))) -(def context-like (ins/inspect-tree (ld/expand (:body (ld/json-get like-url))))) +(def team-ld (:body (ld/json-get team-url))) + +(def context-team (ld/expand-context (ld/fetch-context team-url)) ) +(def context-like (ld/expand-context (ld/fetch-context like-url))) (def team (ap/GET team-url)) +;;(ins/inspect-tree team-ld) ;;(ins/inspect-tree team) -(defn rdf-get [url] - (hato/get url)) -(rdf-get "http://www.w3.org/2000/01/rdf-schema") +(def xsd/String? string?) +(defn rdf/langString? [value] (or (string? value) + (regex mit @ ))) + +(s/def ::activitystreams/name (s/or xsd/string? + rdf/langString?)) \ No newline at end of file diff --git a/src/main/resources/activitystreams-owl.ttl b/src/main/resources/activitystreams_2.0_owl.ttl similarity index 99% rename from src/main/resources/activitystreams-owl.ttl rename to src/main/resources/activitystreams_2.0_owl.ttl index 28354c5..7fffc1c 100644 --- a/src/main/resources/activitystreams-owl.ttl +++ b/src/main/resources/activitystreams_2.0_owl.ttl @@ -1,3 +1,5 @@ +# Downloaded from https://www.w3.org/ns/activitystreams-owl + @prefix : . @prefix as: . @prefix owl: . diff --git a/src/main/resources/rdf-schema.ttl b/src/main/resources/rdf_schema_1.1.ttl similarity index 98% rename from src/main/resources/rdf-schema.ttl rename to src/main/resources/rdf_schema_1.1.ttl index a5b8eac..b6ace12 100644 --- a/src/main/resources/rdf-schema.ttl +++ b/src/main/resources/rdf_schema_1.1.ttl @@ -1,3 +1,5 @@ +# Downloaded from http://www.w3.org/2000/01/rdf-schema + @prefix rdf: . @prefix rdfs: . @prefix owl: . diff --git a/src/main/resources/rdf_syntax_ns_22.ttl b/src/main/resources/rdf_syntax_ns_22.ttl new file mode 100644 index 0000000..150dfe4 --- /dev/null +++ b/src/main/resources/rdf_syntax_ns_22.ttl @@ -0,0 +1,154 @@ +@prefix rdf: . +@prefix rdfs: . +@prefix owl: . +@prefix dc: . + + a owl:Ontology ; + dc:title "The RDF Concepts Vocabulary (RDF)" ; + dc:date "2019-12-16" ; + dc:description "This is the RDF Schema for the RDF vocabulary terms in the RDF Namespace, defined in RDF 1.1 Concepts." . + +rdf:HTML a rdfs:Datatype ; + rdfs:subClassOf rdfs:Literal ; + rdfs:isDefinedBy ; + rdfs:seeAlso ; + rdfs:label "HTML" ; + rdfs:comment "The datatype of RDF literals storing fragments of HTML content" . + +rdf:langString a rdfs:Datatype ; + rdfs:subClassOf rdfs:Literal ; + rdfs:isDefinedBy ; + rdfs:seeAlso ; + rdfs:label "langString" ; + rdfs:comment "The datatype of language-tagged string values" . + +rdf:PlainLiteral a rdfs:Datatype ; + rdfs:isDefinedBy ; + rdfs:subClassOf rdfs:Literal ; + rdfs:seeAlso ; + rdfs:label "PlainLiteral" ; + rdfs:comment "The class of plain (i.e. untyped) literal values, as used in RIF and OWL 2" . + +rdf:type a rdf:Property ; + rdfs:isDefinedBy ; + rdfs:label "type" ; + rdfs:comment "The subject is an instance of a class." ; + rdfs:range rdfs:Class ; + rdfs:domain rdfs:Resource . + +rdf:Property a rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:label "Property" ; + rdfs:comment "The class of RDF properties." ; + rdfs:subClassOf rdfs:Resource . + +rdf:Statement a rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:label "Statement" ; + rdfs:subClassOf rdfs:Resource ; + rdfs:comment "The class of RDF statements." . + +rdf:subject a rdf:Property ; + rdfs:isDefinedBy ; + rdfs:label "subject" ; + rdfs:comment "The subject of the subject RDF statement." ; + rdfs:domain rdf:Statement ; + rdfs:range rdfs:Resource . + +rdf:predicate a rdf:Property ; + rdfs:isDefinedBy ; + rdfs:label "predicate" ; + rdfs:comment "The predicate of the subject RDF statement." ; + rdfs:domain rdf:Statement ; + rdfs:range rdfs:Resource . + +rdf:object a rdf:Property ; + rdfs:isDefinedBy ; + rdfs:label "object" ; + rdfs:comment "The object of the subject RDF statement." ; + rdfs:domain rdf:Statement ; + rdfs:range rdfs:Resource . + +rdf:Bag a rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:label "Bag" ; + rdfs:comment "The class of unordered containers." ; + rdfs:subClassOf rdfs:Container . + +rdf:Seq a rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:label "Seq" ; + rdfs:comment "The class of ordered containers." ; + rdfs:subClassOf rdfs:Container . + +rdf:Alt a rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:label "Alt" ; + rdfs:comment "The class of containers of alternatives." ; + rdfs:subClassOf rdfs:Container . + +rdf:value a rdf:Property ; + rdfs:isDefinedBy ; + rdfs:label "value" ; + rdfs:comment "Idiomatic property used for structured values." ; + rdfs:domain rdfs:Resource ; + rdfs:range rdfs:Resource . + +rdf:List a rdfs:Class ; + rdfs:isDefinedBy ; + rdfs:label "List" ; + rdfs:comment "The class of RDF Lists." ; + rdfs:subClassOf rdfs:Resource . + +rdf:nil a rdf:List ; + rdfs:isDefinedBy ; + rdfs:label "nil" ; + rdfs:comment "The empty list, with no items in it. If the rest of a list is nil then the list has no more items in it." . + +rdf:first a rdf:Property ; + rdfs:isDefinedBy ; + rdfs:label "first" ; + rdfs:comment "The first item in the subject RDF list." ; + rdfs:domain rdf:List ; + rdfs:range rdfs:Resource . + +rdf:rest a rdf:Property ; + rdfs:isDefinedBy ; + rdfs:label "rest" ; + rdfs:comment "The rest of the subject RDF list after the first item." ; + rdfs:domain rdf:List ; + rdfs:range rdf:List . + +rdf:XMLLiteral a rdfs:Datatype ; + rdfs:subClassOf rdfs:Literal ; + rdfs:isDefinedBy ; + rdfs:label "XMLLiteral" ; + rdfs:comment "The datatype of XML literal values." . + +rdf:JSON a rdfs:Datatype ; + rdfs:label "JSON" ; + rdfs:comment "The datatype of RDF literals storing JSON content." ; + rdfs:subClassOf rdfs:Literal ; + rdfs:isDefinedBy ; + rdfs:seeAlso . + +rdf:CompoundLiteral a rdfs:Class ; + rdfs:label "CompoundLiteral" ; + rdfs:comment "A class representing a compound literal." ; + rdfs:subClassOf rdfs:Resource ; + rdfs:isDefinedBy ; + rdfs:seeAlso . + +rdf:language a rdf:Property ; + rdfs:label "language" ; + rdfs:comment "The language component of a CompoundLiteral." ; + rdfs:domain rdf:CompoundLiteral ; + rdfs:isDefinedBy ; + rdfs:seeAlso . + +rdf:direction a rdf:Property ; + rdfs:label "direction" ; + rdfs:comment "The base direction component of a CompoundLiteral." ; + rdfs:domain rdf:CompoundLiteral ; + rdfs:isDefinedBy ; + rdfs:seeAlso .