Fork me on GitHub
#rdf
<
2024-04-14
>
Panel01:04:19

Aren't all those format compatible ? Like you can move from one to the other without loss ? Here's what i mean by edn, it's a malli schema with a vocabulary field that map to, in this case http://schema.org entity. Do you think this is enough data to generate Turtle files ?

(def schema
  [:map
   [:organisation/id {:description "Unique identifier for the organization."
                      :vocabulary [{:context "",
                                    :type "Organization",
                                    :property "identifier",
                                    :url ""}]} :uuid]
   [:organisation/name {:description "The official name of the organization."
                        :vocabulary [{:context "",
                                      :type "Organization",
                                      :property "legalName",
                                      :url ""}]} :string]
   [:organisation/description {:description "A brief description of the organization and its purpose."
                               :vocabulary [{:context "",
                                             :type "Organization",
                                             :property "description",
                                             :url ""}]} :string]
   [:organisation/public-name {:description "A name used by the organization for display or informal purposes."
                               :vocabulary [{:context "",
                                             :type "Organization",
                                             :property "name",
                                             :url ""}]} :string]
   [:organisation/source-data {:description "The original dataset from which information has been derived, unaltered from its initial format."
                               :table "BIOAT.ORGANISATION"}
    organisation-source-schema]])

Panel02:04:07

What do you use to gen Turtle ? https://github.com/structureddynamics/clj-turtle ? Found the ninja stuff https://github.com/quoll/donatello ❤️

❤️ 1
Eric Scott14:04:38

Brace yourself for a shameless plug. I've been working on a couple of libraries you may (or may not) be interested in. • https://github.com/ont-app/vocabulary supports translating between URIs and namespaced Clojure keywords. • https://github.com/ont-app/igraph defines some protocols for graph-shaped data • https://github.com/ont-app/igraph-jena ports the above protocols to the Jena RDF store I'm just sketching here, but my approach to the description you provide above would look like this:

(ns my_project.organization
  {:vann/preferredNamespaceUri ""
   :vann/preferredNamespacePrefix "organization"
   :dc/description "Vocabulary describing organizations we deal with"
   }
  (:require
   [ont-app.igraph.core :as igraph :refer [add!]          
    [ont-app.vocabulary.core :as voc]
    [ont-app.igraph-jena.core :as jena]
    )))

(-> (jena/make-jena-graph)
    (add! [[:organization/id
            :rdf/type :owl/DatatypeProperty
            :rdfs/subPropertyOf :schema/identifier
            :organization/property "identifier"
            :schema/description "Unique identifier for the organization"
            :rdfs/domain :schema/Organization ;; IIRC
            :rdfs/range :organization/UuidDataType
            ]
           [:organization/UuidDataType
            :rdf/type :owl/Datatype
            :schema/description "A string generated by a UUID generator"
            ]
           ;; and so on
           ])
    (jena/write-with-jena-writer "/path/to/my.ttl" "Turtle"))
This would generate at Turtle file in whatever order makes sense to Jena. I believe it also supports JSON-LD. Quoll's libraries would probably give you more control over the actual rendering of the Turtle.