Turtle (.ttl)
-
See Also
- Formats
- "TriG"
- "NTriples"
- "JSONLD"
- "RDFXML"
-
-
See Also
- Formats
- "TriG"
- "NTriples"
- "JSONLD"
- "RDFXML"
-
See Also
Background
Import & Export
Import Elements
Options
Examples
Basic Examples
See Also
GraphStore`
Wolfram Language code:
Wolfram Language code:
Wolfram Language code:
Wolfram Language code:
Turtle (.ttl)
Background
-
- MIME type: text/turtle.
- Text-based format for RDF graphs.
- Turtle is specified at https://www.w3.org/TR/turtle/.
Import Elements
- General Import elements:
-
"Elements" list of elements and options available in this file "Rules" full list of rules for each element and option "Options" list of rules for options, properties and settings - Data representation elements:
-
"Data" an RDFStore "Base" base IRI used to resolve relative IRIs "Prefixes" association of prefixes to namespace IRIs
Options
- Import options:
-
"Base" Automatic base IRI used to resolve relative IRIs - The value of "Base" is only used if the file does not specify a base IRI.
- "Base" can take the following values:
-
Automatic the file name of the imported file None no base IRI "iri" or URL["iri"] an IRI - Export options:
-
"Base" None produce IRIs relative to this base "Prefixes" <||> produce prefixed names using these prefixes - A prefixed name has the form pre:local. The corresponding IRI is obtained by joining the namespace IRI associated with the prefix pre with the local part local.
- "Base" and "Prefixes" can be used to shorten an exported file. These options do not change the meaning of the RDFStore that the file represents.
Examples
Basic Examples (1)
Needs["GraphStore`"]Import a recipe in the Turtle format:
recipeGraph = ImportString["
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX time: <http://www.w3.org/2006/time#>
PREFIX fo: <http://purl.org/ontology/fo/>
PREFIX ex: <http://example.org/>
ex:riceWithMushrooms a ex:recipe ;
rdfs:label \"rice with mushrooms\" ;
fo:ingredients (ex:rice ex:mushroom ex:oil ex:water ex:salt ex:pepper) ;
ex:step ex:heatOil ,
ex:fryMushroom ,
ex:cookRice ,
ex:mixRiceAndMushroom .
ex:cookRice time:minutes 10 .
ex:mixRiceAndMushroom time:after ex:fryMushroom ,
ex:cookRice .
ex:fryMushroom time:after ex:heatOil ;
time:minutes 7 .
", "Turtle"]rdf[s_] := URL["http://www.w3.org/1999/02/22-rdf-syntax-ns#" <> s];
fo[s_] := URL["http://purl.org/ontology/fo/" <> s];
ex[s_] := URL["http://example.org/" <> s];recipeGraph//SPARQLSelect[SPARQLPropertyPath[ex["riceWithMushrooms"], {fo["ingredients"], rdf["rest"]..., rdf["first"]}, SPARQLVariable["ingredient"]]]