背景
Import 与 Export
参数
选项
范例
基本范例
参见
GraphStore`
Wolfram Language code:
Wolfram Language code:
Wolfram Language code:
NQuads (.nq)
背景
-
- MIME type: application/n-quads.
- Line-based format for RDF datasets.
- N-Quads is an extension of N-Triples.
- N-Quads is specified https://www.w3.org/TR/n-quads/.
范例
基本范例 (1)
Needs["GraphStore`"]personStore = ImportString["
<http://example.org/ralph> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://schema.org/Person> .
<http://example.org/ralph> <http://www.w3.org/2000/01/rdf-schema#seeAlso> <http://example.org/graph/ralph> .
<http://example.org/ralph> <http://example.org/hairColor> \"red\" <http://example.org/graph/ralph> .
", "NQuads"]Find all persons together with their hair color:
personStore//SPARQLSelect[{
RDFTriple[SPARQLVariable["person"], URL["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"], URL["http://schema.org/Person"]],
RDFTriple[SPARQLVariable["person"], URL["http://www.w3.org/2000/01/rdf-schema#seeAlso"], SPARQLVariable["g"]],
SPARQLGraph[SPARQLVariable["g"], RDFTriple[SPARQLVariable["person"], URL["http://example.org/hairColor"], SPARQLVariable["hairColor"]]]
} -> {"person", "hairColor"}]