Compare commits

...

6 commits

Author SHA1 Message Date
c115cc4a2e Comment example, use activitystreams as showcase 2023-06-20 13:18:33 +02:00
d7fdf177b7 Try to parse some files 2023-06-20 13:08:04 +02:00
587dae43d8 Add resources for tparse 2023-06-20 12:45:26 +02:00
ea5aa1c926 Fix requires 2023-06-20 12:44:57 +02:00
fb63f6a6e4 Remove submodules 2023-06-20 12:26:23 +02:00
213657ce6c Add clj-tparse module and clj-turtle dep 2023-06-20 11:53:46 +02:00
28 changed files with 445 additions and 9 deletions

View file

@ -18,7 +18,9 @@
[hato "0.9.0"]
[cheshire/cheshire "5.11.0"]
[com.cognitect/transit-clj "1.0.333"]
[lambdaisland/uri "1.13.95"]]
[lambdaisland/uri "1.13.95"]
[clj-turtle "0.1.3"]
[instaparse "1.4.12"]]
:main ^:skip-aot org.domaindrivenarchitecture.activity-pub-poc.core
:profiles {:test {:test-paths ["src/test/cljc"]
:resource-paths ["src/test/resources"]

View file

@ -1,11 +1,12 @@
(ns org.domaindrivenarchitecture.activity-pub-poc.core
(:require [lambdaisland.souk.activitypub :as ap]
[lambdaisland.souk.json-ld :as ld]
[ubindr.clj-tparse.core :as parse]
[clojure.spec.alpha :as s]
[clojure.inspector :as ins]
[hato.client :as hato]
[clojure.string :as str]
[clojure.walk :as walk]) )
[clojure.string :as st]
[clojure.walk :as walk]))
(def team-url "https://social.meissa-gmbh.de/users/team")
(def like-url "https://www.w3.org/ns/activitystreams#Like")
@ -18,13 +19,22 @@
(def team (ap/GET team-url))
(def resource-path "src/main/resources/")
(def activitystreams-ttl (str resource-path "activitystreams_2.0_owl.ttl"))
(def rdf-schema-ttl (str resource-path "rdf_schema_1.1.ttl"))
(def example-ttl (str resource-path "example.ttl"))
(parse/parse-turtle activitystreams-ttl)
;(parse/parse-turtle example-ttl)
;;(ins/inspect-tree team-ld)
;;(ins/inspect-tree team)
;(def xsd/string? string?)
;(defn rdf/langString? [value] (or (string? value)
; (regex mit @ )))
(def xsd/String? string?)
(defn rdf/langString? [value] (or (string? value)
(regex mit @ )))
(s/def ::activitystreams/name (s/or xsd/string?
rdf/langString?))
;(s/def ::activitystreams/name (s/or xsd/string?
; rdf/langString?))

@ -0,0 +1 @@
Subproject commit d99fc8ade8f4390a357f2403c0bcb93b5e8e05d3

View file

@ -0,0 +1,56 @@
turtleDoc ::= statement*
statement ::= directive | triples '.'
directive ::= prefixID | base | sparqlPrefix | sparqlBase
prefixID ::= '@prefix' PNAME_NS IRIREF '.'
base ::= '@base' IRIREF '.'
sparqlBase ::= 'BASE' IRIREF
sparqlPrefix ::= 'PREFIX' PNAME_NS IRIREF
triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList?
predicateObjectList ::= verb objectList (';' (verb objectList)?)*
objectList ::= object (',' object)*
verb ::= predicate | 'a'
subject ::= iri | BlankNode | collection
predicate ::= iri
object ::= iri | BlankNode | collection | blankNodePropertyList | literal
literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
blankNodePropertyList ::= '[' predicateObjectList ']'
collection ::= '(' object* ')'
NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
RDFLiteral ::= String (LANGTAG | '^^' iri)?
BooleanLiteral ::= 'true' | 'false'
String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
iri ::= IRIREF | PrefixedName
PrefixedName ::= PNAME_LN | PNAME_NS
BlankNode ::= BLANK_NODE_LABEL | ANON
IRIREF ::= '<' (#'[^\u0000-\u0020<>\"{}|^`\\]' | UCHAR)* '>'
PNAME_NS ::= PN_PREFIX? ':'
PNAME_LN ::= PNAME_NS PN_LOCAL
BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | #'[0-9]') ((PN_CHARS | '.')* PN_CHARS)?
LANGTAG ::= '@' #'[a-zA-Z]'+ ('-' #'[a-zA-Z0-9]'+)*
INTEGER ::= #'[+-]'? #'[0-9]'+
DECIMAL ::= #'[+-]'? #'[0-9]'* '.' #'[0-9]'+
DOUBLE ::= #'[+-]'? (#'[0-9]'+ '.' #'[0-9]'* EXPONENT | '.' #'[0-9]'+ EXPONENT | #'[0-9]'+ EXPONENT)
EXPONENT ::= #'[eE]' #'[+-]'? #'[0-9]'+
STRING_LITERAL_QUOTE ::= '"' (#'[^\u0022\u005C\u000A\u000D]' | ECHAR | UCHAR)* '"'
STRING_LITERAL_SINGLE_QUOTE ::= "\'" (#'[^\u0027\u005C\u000A\u000D]' | ECHAR | UCHAR)* "\'"
STRING_LITERAL_LONG_SINGLE_QUOTE ::= "\'\'\'" (("\'" | "\'\'")? (#'[^\'\\]' | ECHAR | UCHAR))* "\'\'\'"
STRING_LITERAL_LONG_QUOTE ::= '"""' (('"' | '""')? (#'[^\"\\]' | ECHAR | UCHAR))* '"""'
UCHAR ::= '\\u' HEX HEX HEX HEX | '\\U' HEX HEX HEX HEX HEX HEX HEX HEX
ECHAR ::= '\\u005C' #'[tbnrf"\'\\]'
WS ::= #'[\s]'+ | #'#.*'
ANON ::= '[' WS* ']'
PN_CHARS_BASE ::= #'[A-Z]' | #'[a-z]' | #'[\u00C0-\u00D6]' |
#'[\u00D8-\u00F6]' | #'[\u00F8-\u02FF]' |
#'[\u0370-\u037D]' | #'[\u037F-\u1FFF]' |
#'[\u200C-\u200D]' | #'[\u2070-\u218F]' |
#'[\u2C00-\u2FEF]' | #'[\u3001-\uD7FF]' |
#'[\uF900-\uFDCF]' | #'[\uFDF0-\uFFFD]' |
#'[\x{10000}-\x{EFFFF}]'
PN_CHARS_U ::= PN_CHARS_BASE | '_'
PN_CHARS ::= PN_CHARS_U | '-' | #'[0-9]' | '\\u00B7' | #'[\u0300-\u036F]' | #'[\u203F-\u2040]'
PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
PN_LOCAL ::= (PN_CHARS_U | ':' | #'[0-9]' | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
PLX ::= PERCENT | PN_LOCAL_ESC
PERCENT ::= '%' HEX HEX
HEX ::= #'[0-9]' | #'[A-F]' | #'[a-f]'
PN_LOCAL_ESC ::= '\\u005C' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\\u0027' | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%')

View file

@ -0,0 +1 @@
ECHAR ::= '\\u005C' #'[tbnrf"\'\\]'

View file

@ -0,0 +1,15 @@
@base <http://example.org/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rel: <http://www.perceive.net/schemas/relationship/> .
<#green-goblin>
rel:enemyOf <#spiderman> ;
a foaf:Person ; # in the context of the Marvel universe
foaf:name "Green Goblin" .
<#spiderman>
rel:enemyOf <#green-goblin> ;
a foaf:Person ;
foaf:name "Spiderman", "Человек-паук"@ru .

View file

@ -0,0 +1,22 @@
# A triple with all absolute IRIs
<http://one.example/subject1> <http://one.example/predicate1> <http://one.example/object1> .
@base <http://one.example/> .
<subject2> <predicate2> <object2> . # relative IRIs, e.g. http://one.example/subject2
BASE <http://one.example/>
<subject2> <predicate2> <object2> . # relative IRIs, e.g. http://one.example/subject2
@prefix p: <http://two.example/> .
p:subject3 p:predicate3 p:object3 . # prefixed name, e.g. http://two.example/subject3
PREFIX p: <http://two.example/>
p:subject3 p:predicate3 p:object3 . # prefixed name, e.g. http://two.example/subject3
@prefix p: <path/> . # prefix p: now stands for http://one.example/path/
p:subject4 p:predicate4 p:object4 . # prefixed name, e.g. http://one.example/path/subject4
@prefix : <http://another.example/> . # empty prefix
:subject5 :predicate5 :object5 . # prefixed name, e.g. http://another.example/subject5
:subject6 a :subject7 . # same as :subject6 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> :subject7 .

View file

@ -0,0 +1,10 @@
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix ex: <http://example.org/stuff/1.0/> .
<http://www.w3.org/TR/rdf-syntax-grammar>
dc:title "RDF/XML Syntax Specification (Revised)" ;
ex:editor [
ex:fullname "Dave Beckett";
ex:homePage <http://purl.org/net/dajobe/>
] .

View file

@ -0,0 +1,7 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
[ foaf:name "Alice" ] foaf:knows [
foaf:name "Bob" ;
foaf:knows [
foaf:name "Eve" ] ;
foaf:mbox <bob@example.com> ] .

View file

@ -0,0 +1,6 @@
_:a <http://xmlns.com/foaf/0.1/name> "Alice" .
_:a <http://xmlns.com/foaf/0.1/knows> _:b .
_:b <http://xmlns.com/foaf/0.1/name> "Bob" .
_:b <http://xmlns.com/foaf/0.1/knows> _:c .
_:c <http://xmlns.com/foaf/0.1/name> "Eve" .
_:b <http://xmlns.com/foaf/0.1/mbox> <bob@example.com> .

View file

@ -0,0 +1,9 @@
@prefix : <http://example.org/stuff/1.0/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
:a :b
[ rdf:first "apple";
rdf:rest [ rdf:first "banana";
rdf:rest rdf:nil ]
] .

View file

@ -0,0 +1,9 @@
@prefix : <http://example.org/stuff/1.0/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
:a :b
[ rdf:first "apple";
rdf:rest [ rdf:first "banana";
rdf:rest rdf:nil ]
] .

View file

@ -0,0 +1,9 @@
@prefix : <http://example.org/stuff/1.0/> .
:a :b "The first line\nThe second line\n more" .
:a :b """The first line
The second line
more""" .

View file

@ -0,0 +1,9 @@
@prefix : <http://example.org/stuff/1.0/> .
:a :b "The first line\nThe second line\n more" .
:a :b """The first line
The second line
more""" .

View file

@ -0,0 +1,2 @@
@prefix : <http://example.org/stuff/1.0/> .
(1 2.0 3E1) :p "w" .

View file

@ -0,0 +1,2 @@
PREFIX : <http://example.org/stuff/1.0/>
(1 [:p :q] ( 2 ) ) :p2 :q2 .

View file

@ -0,0 +1,13 @@
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix show: <http://example.org/vocab/show/> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
show:218 rdfs:label "That Seventies Show"^^xsd:string . # literal with XML Schema string datatype
show:218 rdfs:label "That Seventies Show"^^<http://www.w3.org/2001/XMLSchema#string> . # same as above
show:218 rdfs:label "That Seventies Show" . # same again
show:218 show:localName "That Seventies Show"@en . # literal with a language tag
show:218 show:localName 'Cette Série des Années Soixante-dix'@fr . # literal delimited by single quote
show:218 show:localName "Cette Série des Années Septante"@fr-be-be . # literal with a region subtag
show:218 show:blurb '''This is a multi-line # literal with embedded new lines and quotes
literal with many quotes (""""")
and up to two sequential apostrophes ('').''' .

View file

@ -0,0 +1,5 @@
@prefix : <http://example.org/elements> .
<http://en.wikipedia.org/wiki/Helium>
:atomicNumber 2 ; # xsd:integer
:atomicMass 4.002602 ; # xsd:decimal
:specificGravity 1.663E-4 . # xsd:double

View file

@ -0,0 +1,3 @@
@prefix : <http://example.org/stats> .
<http://somecountry.example/census2007>
:isLandlocked false . # xsd:boolean

View file

@ -0,0 +1,5 @@
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
_:alice foaf:knows _:bob .
_:bob foaf:knows _:alice .
[] foaf:knows [ foaf:name "Bob" ] .

View file

@ -0,0 +1,56 @@
turtleDoc ::= statement*
statement ::= directive | triples '.'
directive ::= prefixID | base | sparqlPrefix | sparqlBase
prefixID ::= '@prefix' PNAME_NS IRIREF '.'
base ::= '@base' IRIREF '.'
sparqlBase ::= "BASE" IRIREF
sparqlPrefix ::= "PREFIX" PNAME_NS IRIREF
triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList?
predicateObjectList ::= verb objectList (';' (verb objectList)?)*
objectList ::= object (',' object)*
verb ::= predicate | 'a'
subject ::= iri | BlankNode | collection
predicate ::= iri
object ::= iri | BlankNode | collection | blankNodePropertyList | literal
literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
blankNodePropertyList ::= '[' predicateObjectList ']'
collection ::= '(' object* ')'
NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
RDFLiteral ::= String (LANGTAG | '^^' iri)?
BooleanLiteral ::= 'true' | 'false'
String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
iri ::= IRIREF | PrefixedName
PrefixedName ::= PNAME_LN | PNAME_NS
BlankNode ::= BLANK_NODE_LABEL | ANON
IRIREF ::= '<' (#"[^\u0000-\u0020<>\"{}|^`\\]" | UCHAR)* '>'
PNAME_NS ::= PN_PREFIX? ':'
PNAME_LN ::= PNAME_NS PN_LOCAL
BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | #"[0-9]") ((PN_CHARS | '.')* PN_CHARS)?
LANGTAG ::= '@' #"[a-zA-Z]"+ ('-' #"[a-zA-Z0-9]"+)*
INTEGER ::= #"[+-]"? #"[0-9]"+
DECIMAL ::= #"[+-]"? #"[0-9]"* '.' #"[0-9]"+
DOUBLE ::= #"[+-]"? (#"[0-9]"+ '.' #"[0-9]"* EXPONENT | '.' #"[0-9]"+ EXPONENT | #"[0-9]"+ EXPONENT)
EXPONENT ::= #"[eE]" #"[+-]?" #"[0-9]"+
STRING_LITERAL_QUOTE ::= '"' (#"[^\u0022\u005C\u000A\u000D]" | ECHAR | UCHAR)* '"'
STRING_LITERAL_SINGLE_QUOTE ::= "'" (#"[^\u0027\u005C\u000A\u000D]" | ECHAR | UCHAR)* "'"
STRING_LITERAL_LONG_SINGLE_QUOTE ::= "'''" (("'" | "''")? (#"[^'\\]" | ECHAR | UCHAR))* "'''"
STRING_LITERAL_LONG_QUOTE ::= '\"\"\"' (('"' | '""')? ([^"\\] | ECHAR | UCHAR))* '\"\"\"'
UCHAR ::= "\u" HEX HEX HEX HEX | "\U" HEX HEX HEX HEX HEX HEX HEX HEX
ECHAR ::= "\\" #"[tbnrf\"\'\\]"
WS ::= \u0020 | \u0009 | \u000D | \u000A
ANON ::= "[" WS* "]"
PN_CHARS_BASE ::= #"[A-Z]" | #"[a-z]" | #"[\u00C0-\u00D6]" |
#"[\u00D8-\u00F6]" | #"[\u00F8-\u02FF]" |
#"[\u0370-\u037D]" | #"[\u037F-\u1FFF]" |
#"[\u200C-\u200D]" | #"[\u2070-\u218F]" |
#"[\u2C00-\u2FEF]" | #"[\u3001-\uD7FF]" |
#"[\uF900-\uFDCF]" | #"[\uFDF0-\uFFFD]" |
#"[\x{10000}-\x{EFFFF}]"
PN_CHARS_U ::= PN_CHARS_BASE | "_"
PN_CHARS ::= PN_CHARS_U | "-" | #"[0-9]" | \u00B7 | #"[\u0300-\u036F]" | #"[\u203F-\u2040]"
PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | ".")* PN_CHARS)?
PN_LOCAL ::= (PN_CHARS_U | ":" | #"[0-9]" | PLX) ((PN_CHARS | "." | ":" | PLX)* (PN_CHARS | ":" | PLX))?
PLX ::= PERCENT | PN_LOCAL_ESC
PERCENT ::= "%" HEX HEX
HEX ::= #"[0-9]" | #"[A-F]" | #"[a-f]"
PN_LOCAL_ESC ::= "\\" ("_" | "~" | "." | "-" | "!" | "$" | "&" | \u0027 | "(" | ")" | "*" | "+" | "," | ";" | "=" | "/" | "?" | "#" | "@" | "%")

View file

@ -0,0 +1,56 @@
turtleDoc ::= statement*
statement ::= directive | triples '.'
directive ::= prefixID | base | sparqlPrefix | sparqlBase
prefixID ::= '@prefix' PNAME_NS IRIREF '.'
base ::= '@base' IRIREF '.'
sparqlBase ::= 'BASE' IRIREF
sparqlPrefix ::= 'PREFIX' PNAME_NS IRIREF
triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList?
predicateObjectList ::= verb objectList (';' (verb objectList)?)*
objectList ::= object (',' object)*
verb ::= predicate | 'a'
subject ::= iri | BlankNode | collection
predicate ::= iri
object ::= iri | BlankNode | collection | blankNodePropertyList | literal
literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
blankNodePropertyList ::= '[' predicateObjectList ']'
collection ::= '(' object* ')'
NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
RDFLiteral ::= String (LANGTAG | '^^' iri)?
BooleanLiteral ::= 'true' | 'false'
String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
iri ::= IRIREF | PrefixedName
PrefixedName ::= PNAME_LN | PNAME_NS
BlankNode ::= BLANK_NODE_LABEL | ANON
IRIREF ::= '<' (#'[^\u0000-\u0020<>\"{}|^`\\]' | UCHAR)* '>'
PNAME_NS ::= PN_PREFIX? ':'
PNAME_LN ::= PNAME_NS PN_LOCAL
BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | #'[0-9]') ((PN_CHARS | '.')* PN_CHARS)?
LANGTAG ::= '@' #'[a-zA-Z]'+ ('-' #'[a-zA-Z0-9]'+)*
INTEGER ::= #'[+-]'? #'[0-9]'+
DECIMAL ::= #'[+-]'? #'[0-9]'* '.' #'[0-9]'+
DOUBLE ::= #'[+-]'? (#'[0-9]'+ '.' #'[0-9]'* EXPONENT | '.' #'[0-9]'+ EXPONENT | #'[0-9]'+ EXPONENT)
EXPONENT ::= #'[eE]' #'[+-]?' #'[0-9]'+
STRING_LITERAL_QUOTE ::= \"'\" (#'[^\u0022\u005C\u000A\u000D]' | ECHAR | UCHAR)* \"'\"
STRING_LITERAL_SINGLE_QUOTE ::= \"'\" (#'[^\u0027\u005C\u000A\u000D]' | ECHAR | UCHAR)* \"'\"
STRING_LITERAL_LONG_SINGLE_QUOTE ::= \"'''\" ((\"'\" | \"''\")? (#'[^'\\]' | ECHAR | UCHAR))* \"'''\"
STRING_LITERAL_LONG_QUOTE ::= '\"\"\"' (('\"' | '\"\"')? (#'[^\"\\]' | ECHAR | UCHAR))* '\"\"\"'
UCHAR ::= '\\u' HEX HEX HEX HEX | '\\U' HEX HEX HEX HEX HEX HEX HEX HEX
ECHAR ::= '\\' #'[tbnrf\"\'\\]'
WS ::= #'[\u0020]'+ | #'[\u0009]'+ | #'[\u000D]'+ | #'[\u000A]'+
ANON ::= '[' WS* ']'
PN_CHARS_BASE ::= #'[A-Z]' | #'[a-z]' | #'[\u00C0-\u00D6]' |
#'[\u00D8-\u00F6]' | #'[\u00F8-\u02FF]' |
#'[\u0370-\u037D]' | #'[\u037F-\u1FFF]' |
#'[\u200C-\u200D]' | #'[\u2070-\u218F]' |
#'[\u2C00-\u2FEF]' | #'[\u3001-\uD7FF]' |
#'[\uF900-\uFDCF]' | #'[\uFDF0-\uFFFD]' |
#'[\x{10000}-\x{EFFFF}]'
PN_CHARS_U ::= PN_CHARS_BASE | '_'
PN_CHARS ::= PN_CHARS_U | '-' | #'[0-9]' | #'[\u00B7]' | #'[\u0300-\u036F]' | #'[\u203F-\u2040]'
PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
PN_LOCAL ::= (PN_CHARS_U | ':' | #'[0-9]' | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
PLX ::= PERCENT | PN_LOCAL_ESC
PERCENT ::= '%' HEX HEX
HEX ::= #'[0-9]' | #'[A-F]' | #'[a-f]'
PN_LOCAL_ESC ::= '\\' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | #'[\u0027]' | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%')

View file

@ -0,0 +1,68 @@
turtleDoc ::= statement*
<statement> ::= directive | WSE* triples WS* <'.'> WSE*
<directive> ::= prefix | base
prefix ::= WS* prefixID WSE* | WS* sparqlPrefix WSE*
base ::= WS* regBase WSE* | WS* sparqlBase WSE*
<prefixID> ::= <'@prefix'> WS+ PNAME_NS WS+ iri WS* <'.'>
<regBase> ::= <'@base'> WS+ iri WS+ <'.'>
<sparqlBase> ::= <#'[BbAaSsEe]+'> WS+ iri
<sparqlPrefix> ::= <#'[PpRrEeFfIiXx]+'> WS+ PNAME_NS WS+ iri
triples ::= subject WSE+ predicateObjectList | blankNodePropertyList WSE+ predicateObjectList?
predicateObjectList ::= predicate WSE+ objectList WSE* (<';'> WSE+ (predicate WS+ objectList)?)*
objectList ::= object WSE* (<','> WSE* object)*
predicate ::= verb | a
a ::= 'a'
subject ::= iri | BlankNode | collection
<verb> ::= iri
object ::= iri | BlankNode | collection | blankNodePropertyList | literal
literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
blankNodePropertyList ::= <'['> WSE* predicateObjectList WSE* <']'>
collection ::= <'('> object-wse* <')'>
<object-wse> ::= object | WSE*
<NumericLiteral> ::= integer | decimal | double
RDFLiteral ::= string (langtag | <'^^'> iri)?
BooleanLiteral ::= 'true' | 'false'
string ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
iri ::= IRIREF | PrefixedName
PrefixedName ::= PNAME_LN | PNAME_NS
BlankNode ::= BLANK_NODE_LABEL | ANON
<EOL> ::= <#'[\n\r]+'>
<IRIREF> ::= FULLIRI | ref
ref ::= <'<'> (#'[^\u0000-\u0020<>\"{}:|^`\\]+' | UCHAR)* <'>'>
<FULLIRI> ::= <'<'> (#'[^\u0000-\u0020<>\"{}|^`\\]*' | UCHAR)* <'>'>
<PNAME_NS> ::= PN_PREFIX? ':'
<PNAME_LN> ::= PNAME_NS PN_LOCAL
<BLANK_NODE_LABEL> ::= '_:' (PN_CHARS_U | #'[0-9]') ((PN_CHARS | '.')* PN_CHARS)?
langtag ::= '@' #'[a-zA-Z]+' ('-' #'[a-zA-Z0-9]+')*
integer ::= #'[+-]'? #'[0-9]+'
decimal ::= #'[+-]'? #'[0-9]*' '.' #'[0-9]+'
double ::= #'[+-]'? (#'[0-9]+' '.' #'[0-9]*' EXPONENT | '.' #'[0-9]+' EXPONENT | #'[0-9]+' EXPONENT)
<EXPONENT> ::= #'[eE]' #'[+-]'? #'[0-9]'+
<STRING_LITERAL_QUOTE> ::= <'"'> line-double <'"'>
<line-single> ::= (#'[^\u0022\u005C\u000A\u000D\']*' | ECHAR | UCHAR)*
<line-double> ::= (#'[^\u0022\u005C\u000A\u000D\"]*' | ECHAR | UCHAR)*
<STRING_LITERAL_SINGLE_QUOTE> ::= <"\'"> line-single <"\'">
<STRING_LITERAL_LONG_SINGLE_QUOTE> ::= <"\'\'\'"> multi-line-single <"\'\'\'">
<multi-line-double> ::= (('"' | '""')? (#'[^\"\\]*' | ECHAR | UCHAR))*
<multi-line-single> ::= (("\'" | "\'\'")? (#'[^\'\\]*' | ECHAR | UCHAR))*
<STRING_LITERAL_LONG_QUOTE> ::= <'"""'> multi-line-double <'"""'>
<UCHAR> ::= '\\u' HEX HEX HEX HEX | '\\U' HEX HEX HEX HEX HEX HEX HEX HEX
<ECHAR> ::= '\\' #'[tbnrf"\'\\]'
<WSE> ::= WS? EOL?
<WS> ::= <#'[ \t]*'> | <#'#.*'>
<ANON> ::= '[' WSE* ']'
<PN_CHARS_BASE> ::= #'[a-zA-Z]+' | #'[\u00C0-\u00D6]+' |
#'[\u00D8-\u00F6]+' | #'[\u00F8-\u02FF]+' |
#'[\u0370-\u037D]+' | #'[\u037F-\u1FFF]+' |
#'[\u200C-\u200D]+' | #'[\u2070-\u218F]+' |
#'[\u2C00-\u2FEF]+' | #'[\u3001-\uD7FF]+' |
#'[\uF900-\uFDCF]+' | #'[\uFDF0-\uFFFD]+' |
#'[\x{10000}-\x{EFFFF}]+'
<PN_CHARS_U> ::= PN_CHARS_BASE | '_'
<PN_CHARS> ::= PN_CHARS_U | '-' | #'[0-9]' | '\\u00B7' | #'[\u0300-\u036F]' | #'[\u203F-\u2040]'
<PN_PREFIX> ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
<PN_LOCAL> ::= (PN_CHARS_U | ':' | #'[0-9]+' | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
<PLX> ::= PERCENT | PN_LOCAL_ESC
<PERCENT> ::= '%' HEX HEX
<HEX> ::= #'[0-9]' | #'[A-F]' | #'[a-f]'
<PN_LOCAL_ESC> ::= '\\u005C' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\\u0027' | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%')

View file

@ -0,0 +1 @@
STRING_LITERAL_LONG_QUOTE ::= '"""' (('"' | '""')? (#'[^\"\\]' | ECHAR | UCHAR))* '"""'

View file

@ -0,0 +1 @@
STRING_LITERAL_LONG_SINGLE_QUOTE ::= "\'\'\'" (("\'" | "\'\'")? (#'[^\'\\]' | ECHAR | UCHAR))* "\'\'\'"

View file

@ -0,0 +1 @@
STRING_LITERAL_QUOTE ::= '"' (#'[^\u0022\u005C\u000A\u000D]' | ECHAR | UCHAR)* '"'

View file

@ -0,0 +1 @@
STRING_LITERAL_SINGLE_QUOTE ::= "\'" (#'[^\u0027\u005C\u000A\u000D]' | ECHAR | UCHAR)* "\'"

View file

@ -0,0 +1,56 @@
turtleDoc ::= statement*
statement ::= directive | triples '.'
directive ::= prefixID | base | sparqlPrefix | sparqlBase
prefixID ::= '@prefix' PNAME_NS IRIREF '.'
base ::= '@base' IRIREF '.'
sparqlBase ::= 'BASE' IRIREF
sparqlPrefix ::= 'PREFIX' PNAME_NS IRIREF
triples ::= subject predicateObjectList | blankNodePropertyList predicateObjectList?
predicateObjectList ::= verb objectList (';' (verb objectList)?)*
objectList ::= object (',' object)*
verb ::= predicate | 'a'
subject ::= iri | BlankNode | collection
predicate ::= iri
object ::= iri | BlankNode | collection | blankNodePropertyList | literal
literal ::= RDFLiteral | NumericLiteral | BooleanLiteral
blankNodePropertyList ::= '[' predicateObjectList ']'
collection ::= '(' object* ')'
NumericLiteral ::= INTEGER | DECIMAL | DOUBLE
RDFLiteral ::= String (LANGTAG | '^^' iri)?
BooleanLiteral ::= 'true' | 'false'
String ::= STRING_LITERAL_QUOTE | STRING_LITERAL_SINGLE_QUOTE | STRING_LITERAL_LONG_SINGLE_QUOTE | STRING_LITERAL_LONG_QUOTE
iri ::= IRIREF | PrefixedName
PrefixedName ::= PNAME_LN | PNAME_NS
BlankNode ::= BLANK_NODE_LABEL | ANON
IRIREF ::= '<' (#'[^\u0000-\u0020<>\"{}|^`\\]' | UCHAR)* '>'
PNAME_NS ::= PN_PREFIX? ':'
PNAME_LN ::= PNAME_NS PN_LOCAL
BLANK_NODE_LABEL ::= '_:' (PN_CHARS_U | #'[0-9]') ((PN_CHARS | '.')* PN_CHARS)?
LANGTAG ::= '@' #'[a-zA-Z]'+ ('-' #'[a-zA-Z0-9]'+)*
INTEGER ::= #'[+-]'? #'[0-9]'+
DECIMAL ::= #'[+-]'? #'[0-9]'* '.' #'[0-9]'+
DOUBLE ::= #'[+-]'? (#'[0-9]'+ '.' #'[0-9]'* EXPONENT | '.' #'[0-9]'+ EXPONENT | #'[0-9]'+ EXPONENT)
EXPONENT ::= #'[eE]' #'[+-]'? #'[0-9]'+
STRING_LITERAL_QUOTE ::= '"' (#'[^\u0022\u005C\u000A\u000D]' | ECHAR | UCHAR)* '"'
STRING_LITERAL_SINGLE_QUOTE ::= "\'" (#'[^\u0027\u005C\u000A\u000D]' | ECHAR | UCHAR)* "\'"
STRING_LITERAL_LONG_SINGLE_QUOTE ::= "\'\'\'" (("\'" | "\'\'")? (#'[^\'\\]' | ECHAR | UCHAR))* "\'\'\'"
STRING_LITERAL_LONG_QUOTE ::= '"""' (('"' | '""')? (#'[^\"\\]' | ECHAR | UCHAR))* '"""'
UCHAR ::= '\\u' HEX HEX HEX HEX | '\\U' HEX HEX HEX HEX HEX HEX HEX HEX
ECHAR ::= '\\u005C' #'[tbnrf"\'\\]'
WS ::= #'[\s]'+ | #'#.*'
ANON ::= '[' WS* ']'
PN_CHARS_BASE ::= #'[A-Z]' | #'[a-z]' | #'[\u00C0-\u00D6]' |
#'[\u00D8-\u00F6]' | #'[\u00F8-\u02FF]' |
#'[\u0370-\u037D]' | #'[\u037F-\u1FFF]' |
#'[\u200C-\u200D]' | #'[\u2070-\u218F]' |
#'[\u2C00-\u2FEF]' | #'[\u3001-\uD7FF]' |
#'[\uF900-\uFDCF]' | #'[\uFDF0-\uFFFD]' |
#'[\x{10000}-\x{EFFFF}]'
PN_CHARS_U ::= PN_CHARS_BASE | '_'
PN_CHARS ::= PN_CHARS_U | '-' | #'[0-9]' | '\\u00B7' | #'[\u0300-\u036F]' | #'[\u203F-\u2040]'
PN_PREFIX ::= PN_CHARS_BASE ((PN_CHARS | '.')* PN_CHARS)?
PN_LOCAL ::= (PN_CHARS_U | ':' | #'[0-9]' | PLX) ((PN_CHARS | '.' | ':' | PLX)* (PN_CHARS | ':' | PLX))?
PLX ::= PERCENT | PN_LOCAL_ESC
PERCENT ::= '%' HEX HEX
HEX ::= #'[0-9]' | #'[A-F]' | #'[a-f]'
PN_LOCAL_ESC ::= '\\u005C' ('_' | '~' | '.' | '-' | '!' | '$' | '&' | '\\u0027' | '(' | ')' | '*' | '+' | ',' | ';' | '=' | '/' | '?' | '#' | '@' | '%')