module Hydra.Impl.Haskell.Sources.Ext.Rdf.Syntax where

import Hydra.Impl.Haskell.Sources.Core

import Hydra.All
import Hydra.Impl.Haskell.Dsl.Types as Types
import Hydra.Impl.Haskell.Dsl.Standard


rdfSyntaxModule :: Module Meta
rdfSyntaxModule :: Module Meta
rdfSyntaxModule = forall m.
Namespace -> [Element m] -> [Module m] -> Maybe String -> Module m
Module Namespace
ns [Element Meta]
elements [] forall a b. (a -> b) -> a -> b
$
    forall a. a -> Maybe a
Just String
"An RDF 1.1 syntax model"
  where
    ns :: Namespace
ns = String -> Namespace
Namespace String
"hydra/ext/rdf/syntax"
    def :: String -> Type m -> Element m
def = forall m. Namespace -> String -> Type m -> Element m
datatype Namespace
ns
    rdf :: String -> Type m
rdf = forall m. Namespace -> String -> Type m
nsref Namespace
ns

    elements :: [Element Meta]
elements = [

      forall {m}. String -> Type m -> Element m
def String
"BlankNode" forall m. Type m
string,

      forall {m}. String -> Type m -> Element m
def String
"RdfsClass"
        forall a b. (a -> b) -> a -> b
$ String -> Type Meta -> Type Meta
doc String
"Stand-in for rdfs:Class" forall m. Type m
unit,

      forall {m}. String -> Type m -> Element m
def String
"Dataset" forall a b. (a -> b) -> a -> b
$ forall m. Type m -> Type m
set forall a b. (a -> b) -> a -> b
$ forall {m}. String -> Type m
rdf String
"Quad",

      forall {m}. String -> Type m -> Element m
def String
"Description" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"A graph of RDF statements together with a distinguished subject and/or object node" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"subject"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Node",
          String
"graph"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Graph"],

      forall {m}. String -> Type m -> Element m
def String
"Graph" forall a b. (a -> b) -> a -> b
$ forall m. Type m -> Type m
set forall a b. (a -> b) -> a -> b
$ forall {m}. String -> Type m
rdf String
"Triple",

      forall {m}. String -> Type m -> Element m
def String
"Iri" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"An Internationalized Resource Identifier"
        forall m. Type m
string,

      forall {m}. String -> Type m -> Element m
def String
"IriOrLiteral" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc (String
"An IRI or a literal; " forall a. [a] -> [a] -> [a]
++
             String
"this type is a convenience for downstream models like SHACL which may exclude blank nodes") forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
union [
          String
"iri"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Iri",
          String
"literal"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Literal"],

      forall {m}. String -> Type m -> Element m
def String
"LangStrings" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"A convenience type which provides at most one string value per language, and optionally a value without a language" forall a b. (a -> b) -> a -> b
$
        forall m. Type m -> Type m -> Type m
Types.map (forall m. Type m -> Type m
optional forall a b. (a -> b) -> a -> b
$ forall {m}. String -> Type m
rdf String
"LanguageTag") forall m. Type m
string,

      forall {m}. String -> Type m -> Element m
def String
"LanguageTag" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"A BCP47 language tag"
        forall m. Type m
string,

      forall {m}. String -> Type m -> Element m
def String
"Literal" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"A value such as a string, number, or date" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"lexicalForm"forall m. String -> Type m -> FieldType m
>:
            String -> Type Meta -> Type Meta
doc String
"a Unicode string, which should be in Normal Form C"
            forall m. Type m
string,
          String
"datatypeIri"forall m. String -> Type m -> FieldType m
>:
            String -> Type Meta -> Type Meta
doc String
"an IRI identifying a datatype that determines how the lexical form maps to a literal value" forall a b. (a -> b) -> a -> b
$
            forall {m}. String -> Type m
rdf String
"Iri",
          String
"languageTag"forall m. String -> Type m -> FieldType m
>:
            String -> Type Meta -> Type Meta
doc String
"An optional language tag, present if and only if the datatype IRI is http://www.w3.org/1999/02/22-rdf-syntax-ns#langString" forall a b. (a -> b) -> a -> b
$
            forall m. Type m -> Type m
optional forall a b. (a -> b) -> a -> b
$ forall {m}. String -> Type m
rdf String
"LanguageTag"],

      forall {m}. String -> Type m -> Element m
def String
"Node" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
union [
          String
"iri"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Iri",
          String
"bnode"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"BlankNode",
          String
"literal"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Literal"],

      forall {m}. String -> Type m -> Element m
def String
"Property" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"A type representing an RDF property, and encapsulating its domain, range, and subclass relationships" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"domain"forall m. String -> Type m -> FieldType m
>:
            String -> Type Meta -> Type Meta
doc String
"State that any resource that has a given property is an instance of one or more classes" forall a b. (a -> b) -> a -> b
$
            forall m. Type m -> Type m
set forall a b. (a -> b) -> a -> b
$ forall {m}. String -> Type m
rdf String
"RdfsClass",
          String
"range"forall m. String -> Type m -> FieldType m
>:
            String -> Type Meta -> Type Meta
doc String
"States that the values of a property are instances of one or more classes" forall a b. (a -> b) -> a -> b
$
            forall m. Type m -> Type m
set forall a b. (a -> b) -> a -> b
$ forall {m}. String -> Type m
rdf String
"RdfsClass",
          String
"subPropertyOf"forall m. String -> Type m -> FieldType m
>:
            forall m. Type m -> Type m
set forall a b. (a -> b) -> a -> b
$ forall {m}. String -> Type m
rdf String
"Property"],

      forall {m}. String -> Type m -> Element m
def String
"Quad" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"An RDF triple with an optional named graph component" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"subject"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Resource",
          String
"predicate"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Iri",
          String
"object"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Node",
          String
"graph"forall m. String -> Type m -> FieldType m
>: forall m. Type m -> Type m
optional forall a b. (a -> b) -> a -> b
$ forall {m}. String -> Type m
rdf String
"Iri"],

      forall {m}. String -> Type m -> Element m
def String
"Resource" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
union [
          String
"iri"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Iri",
          String
"bnode"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"BlankNode"],

      forall {m}. String -> Type m -> Element m
def String
"Triple" forall a b. (a -> b) -> a -> b
$
        String -> Type Meta -> Type Meta
doc String
"An RDF triple defined by a subject, predicate, and object" forall a b. (a -> b) -> a -> b
$
        forall m. [FieldType m] -> Type m
record [
          String
"subject"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Resource",
          String
"predicate"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Iri",
          String
"object"forall m. String -> Type m -> FieldType m
>: forall {m}. String -> Type m
rdf String
"Node"]]