WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

Background

Import & Export

Import Elements

Options

Examples  
Basic Examples  
See Also
GraphStore`

TriG (.trig)

Background

Import & Export

  • Import ["file.trig"] imports a TriG file, returning and RDFStore .
  • Import ["file.trig",elements] imports the specified elements.
  • Export ["file.trig",expr] exports an RDFStore to a TriG file.

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)

Wolfram Language code: Needs["GraphStore`"]

Import TriG data:

Wolfram Language code: store = ImportString[" prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> prefix ex: <http://example.org/> ex:fruitGraph rdfs:label \"fruit graph\". ex:fruitGraph rdfs:comment \"data about fruits\". ex:fruitGraph { ex:banana rdfs:label \"banana\". ex:banana a ex:Fruit. ex:banana ex:color \"yellow\". }", "TriG"]

Export the same dataset:

Wolfram Language code: ExportString[store, "TriG"]

Specify prefixes to shorten IRIs:

Wolfram Language code: ExportString[store, "TriG", "Prefixes" -> <| "rdfs" -> "http://www.w3.org/2000/01/rdf-schema#", "ex" -> "http://example.org/" |>]

Specify a base instead:

Wolfram Language code: ExportString[store, "TriG", "Base" -> "http://example.org/", "Prefixes" -> <|"rdfs" -> "http://www.w3.org/2000/01/rdf-schema#"|> ]

See Also

Formats: Turtle   JSONLD   RDFXML

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /