-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added RDF Turtle/TriG language (#2012)
This adds support for the RDF Turtle/TriG language.
- Loading branch information
1 parent
7cb65ee
commit 508d57a
Showing
16 changed files
with
781 additions
and
3 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
Prism.languages.turtle = { | ||
'comment': { | ||
pattern: /#.*/, | ||
greedy: true | ||
}, | ||
'multiline-string': { | ||
pattern: /"""(?:[^"]"?"?)*"""|'''(?:[^']'?'?)*'''/, | ||
greedy: true, | ||
alias: 'string', | ||
inside: { | ||
'comment': /#.*/ | ||
} | ||
}, | ||
'string': { | ||
pattern: /"(?:[^\\"\r\n]|\\.)*"|'(?:[^\\'\r\n]|\\.)*'/, | ||
greedy: true | ||
}, | ||
'url': { | ||
pattern: /<[^\s<>]*>/, | ||
greedy: true, | ||
inside: { | ||
'punctuation': /[<>]/ | ||
} | ||
}, | ||
'function': { | ||
pattern: /(?:(?![-.\d\xB7])[-.\w\xB7\xC0-\uFFFD]+)?:(?:(?![-.])(?:[-.:\w\xC0-\uFFFD]|%[\da-f]{2}|\\.)+)?/i, | ||
inside: { | ||
'local-name': { | ||
pattern: /([^:]*:)[\s\S]+/, | ||
lookbehind: true | ||
}, | ||
'prefix': { | ||
pattern: /[\s\S]+/, | ||
inside: { | ||
'punctuation': /:/ | ||
} | ||
} | ||
} | ||
}, | ||
'number': /[+-]?\b\d+\.?\d*(?:e[+-]?\d+)?/i, | ||
'punctuation': /[{}.,;()[\]]|\^\^/, | ||
'boolean': /\b(?:true|false)\b/, | ||
'keyword': [ | ||
/(?:\ba|@prefix|@base)\b|=/, | ||
/\b(?:graph|base|prefix)\b|=/i | ||
], | ||
'tag': { | ||
'pattern': /@[a-z]+(?:-[a-z\d]+)*/i, | ||
inside: { | ||
'punctuation': /@/ | ||
} | ||
} | ||
}; | ||
Prism.languages.trig = Prism.languages['turtle']; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<h2>Full example</h2> | ||
<pre><code>@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/> . | ||
|
||
GRAPH <urn:myGraph> { | ||
<#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 . | ||
}</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
<http://www.w3.org/TR/rdf-syntax-grammar> <http://purl.org/dc/elements/1.1/title> "RDF/XML Syntax Specification (Revised)" . | ||
<http://www.w3.org/TR/rdf-syntax-grammar> <http://example.org/stuff/1.0/editor> _:bnode . | ||
_:bnode <http://example.org/stuff/1.0/fullname> "Dave Beckett" . | ||
_:bnode <http://example.org/stuff/1.0/homePage> <http://purl.org/net/dajobe/> . | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["url", [ | ||
["punctuation", "<"], | ||
"http://www.w3.org/TR/rdf-syntax-grammar", | ||
["punctuation", ">"] | ||
]], | ||
["url", [ | ||
["punctuation", "<"], | ||
"http://purl.org/dc/elements/1.1/title", | ||
["punctuation", ">"] | ||
]], | ||
["string", "\"RDF/XML Syntax Specification (Revised)\""], | ||
["punctuation", "."], | ||
["url", [ | ||
["punctuation", "<"], | ||
"http://www.w3.org/TR/rdf-syntax-grammar", | ||
["punctuation", ">"] | ||
]], | ||
["url", [ | ||
["punctuation", "<"], | ||
"http://example.org/stuff/1.0/editor", | ||
["punctuation", ">"] | ||
]], | ||
["function", [ | ||
["prefix", [ | ||
"_", | ||
["punctuation", ":"] | ||
]], | ||
["local-name", "bnode"] | ||
]], | ||
["punctuation", "."], | ||
["function", [ | ||
["prefix", [ | ||
"_", | ||
["punctuation", ":"] | ||
]], | ||
["local-name", "bnode"] | ||
]], | ||
["url", [ | ||
["punctuation", "<"], | ||
"http://example.org/stuff/1.0/fullname", | ||
["punctuation", ">"] | ||
]], | ||
["string", "\"Dave Beckett\""], | ||
["punctuation", "."], | ||
["function", [ | ||
["prefix", [ | ||
"_", | ||
["punctuation", ":"] | ||
]], | ||
["local-name", "bnode"] | ||
]], | ||
["url", [ | ||
["punctuation", "<"], | ||
"http://example.org/stuff/1.0/homePage", | ||
["punctuation", ">"] | ||
]], | ||
["url", [ | ||
["punctuation", "<"], | ||
"http://purl.org/net/dajobe/", | ||
["punctuation", ">"] | ||
]], | ||
["punctuation", "."] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks blank node underscore prefixes. |
Oops, something went wrong.