RDFStore[{t1,t2,…}]
トリプル tiを持つRDFグラフを表す.
RDFStore[{t1,t2,…},name1{s11,s12,…},…]
デフォルトのグラフがトリプル tiからなり,名前付きのグラフが nameiという名前のトリプル sijからなるRDFデータ集合を表す.
RDFStore
RDFStore[{t1,t2,…}]
トリプル tiを持つRDFグラフを表す.
RDFStore[{t1,t2,…},name1{s11,s12,…},…]
デフォルトのグラフがトリプル tiからなり,名前付きのグラフが nameiという名前のトリプル sijからなるRDFデータ集合を表す.
詳細とオプション
- RDFはリソース・ディスクリプション・フレームワークを意味する.
- リソースはIRIで識別される.
- リソースについての記述はトリプルRDFTriple[subj, pred, obj]で行われる.subj は説明される主語, pred は述語,obj は値である.
- 主語,述語,目的語は,IRIまはた空白ノードであることが多い.目的語は,文字列,数,ブール値のようなリテラルでもよい.
- SPARQLSelect[pattern]を使ってRDFデータ集合についてのクエリを行うと,pattern がデフォルトグラフと照合される.SPARQLSelect[SPARQLGraph[name,pattern]]を使って名前が name のグラフと pattern を照合することもできる.
例題
すべて開く すべて閉じる例 (1)
Needs["GraphStore`"]rdf[s_] := URL["http://www.w3.org/1999/02/22-rdf-syntax-ns#" <> s];
rdfs[s_] := URL["http://www.w3.org/2000/01/rdf-schema#" <> s];
schema[s_] := URL["http://schema.org/" <> s];
ex[s_] := URL["http://example.org/" <> s];einsteinStore = RDFStore[{
RDFTriple[ex["einstein"], rdf["type"], schema["Person"]],
RDFTriple[ex["einstein"], rdfs["label"], "Albert Einstein"],
RDFTriple[ex["einstein"], schema["birthDate"], DateObject[{1879, 3, 14}, TimeZone -> None]]
}];einsteinStore//SPARQLSelect[
RDFTriple[SPARQLVariable["s"], SPARQLVariable["p"], SPARQLVariable["o"]] -> "p",
"Distinct" -> True
]einsteinStore//SPARQLSelect[{
RDFTriple[SPARQLVariable["person"], rdfs["label"], SPARQLVariable["name"]],
RDFTriple[SPARQLVariable["person"], schema["birthDate"], SPARQLVariable["birthDate"]]
} -> {"name", "birthDate"}]"Turtle"形式でエキスポートする:
ExportString[einsteinStore, "Turtle", "Prefixes" -> <|
"rdfs" -> "http://www.w3.org/2000/01/rdf-schema#",
"xsd" -> "http://www.w3.org/2001/XMLSchema#",
"schema" -> "http://schema.org/",
"ex" -> "http://example.org/"
|>]スコープ (2)
Needs["GraphStore`"]rdf[s_] := URL["http://www.w3.org/1999/02/22-rdf-syntax-ns#" <> s];
rdfs[s_] := URL["http://www.w3.org/2000/01/rdf-schema#" <> s];
owl[s_] := URL["http://www.w3.org/2002/07/owl#" <> s];
wd[s_] := URL["http://www.wikidata.org/entity/" <> s];
schema[s_] := URL["http://schema.org/" <> s];
ex[s_] := URL["http://example.org/" <> s];countryStore = RDFStore[{
(* Spain *)
RDFTriple[ex["spain"], rdf["type"], schema["Country"]],
RDFTriple[ex["spain"], rdfs["label"], "Spain"],
RDFTriple[ex["spain"], ex["population"], 46528024],
RDFTriple[ex["spain"], owl["sameAs"], wd["Q29"]],
(* Hungary *)
RDFTriple[ex["hungary"], rdf["type"], schema["Country"]],
RDFTriple[ex["hungary"], rdfs["label"], "Hungary"],
RDFTriple[ex["hungary"], ex["population"], 9817958],
RDFTriple[ex["hungary"], owl["sameAs"], wd["Q28"]]
}]countryStore//SPARQLSelect[RDFTriple[ex["spain"], ex["population"], SPARQLVariable["pop"]]]countryStore//SPARQLSelect[{
RDFTriple[SPARQLVariable["country"], rdfs["label"], SPARQLVariable["label"]],
RDFTriple[SPARQLVariable["country"], ex["population"], SPARQLVariable["pop"]]
} -> {"label", "pop"}]countryStore//SPARQLSelect[{
RDFTriple[SPARQLVariable["country"], owl["sameAs"], wd["Q29"]],
RDFTriple[SPARQLVariable["country"], rdfs["label"], SPARQLVariable["label"]],
RDFTriple[SPARQLVariable["country"], ex["population"], SPARQLVariable["pop"]]
} -> {"label", "pop"}]Needs["GraphStore`"]デフォルトグラフによる現行データと年によって名前が付けられたグラフによる過去のデータをともなう国のデータ:
rdf[s_] := URL["http://www.w3.org/1999/02/22-rdf-syntax-ns#" <> s];
rdfs[s_] := URL["http://www.w3.org/2000/01/rdf-schema#" <> s];
owl[s_] := URL["http://www.w3.org/2002/07/owl#" <> s];
wd[s_] := URL["http://www.wikidata.org/entity/" <> s];
schema[s_] := URL["http://schema.org/" <> s];
time[s_] := URL["http://www.w3.org/2006/time#" <> s];
ex[s_] := URL["http://example.org/" <> s];countryStore = RDFStore[
{
(* Spain *)
RDFTriple[ex["spain"], rdf["type"], schema["Country"]],
RDFTriple[ex["spain"], rdfs["label"], "Spain"],
RDFTriple[ex["spain"], ex["population"], 46528024],
RDFTriple[ex["spain"], owl["sameAs"], wd["Q29"]],
(* Hungary *)
RDFTriple[ex["hungary"], rdf["type"], schema["Country"]],
RDFTriple[ex["hungary"], rdfs["label"], "Hungary"],
RDFTriple[ex["hungary"], ex["population"], 9817958],
RDFTriple[ex["hungary"], owl["sameAs"], wd["Q28"]]
},
<|
ex["historical/1961"] -> {
RDFTriple[ex["historical/1961"], time["year"], 1961],
RDFTriple[ex["spain"], ex["population"], 30739250]
},
ex["historical/1980"] -> {
RDFTriple[ex["historical/1980"], time["year"], 1980],
RDFTriple[ex["spain"], ex["population"], 37439035]
}
|>
];データ集合中のデフォルトグラフにあるすべての国の現在の人口を求める:
countryStore//SPARQLSelect[{
RDFTriple[SPARQLVariable["country"], rdfs["label"], SPARQLVariable["label"]],
RDFTriple[SPARQLVariable["country"], ex["population"], SPARQLVariable["pop"]]
} -> {"label", "pop"}]countryStore//SPARQLSelect[SPARQLGraph[SPARQLVariable["g"], {
RDFTriple[SPARQLVariable["g"], time["year"], SPARQLVariable["year"]],
RDFTriple[ex["spain"], ex["population"], SPARQLVariable["pop"]]
}] -> {"year", "pop"}]特性と関係 (2)
Needs["GraphStore`"]ex[s_] := URL["http://example.org/" <> s];personStore = RDFStore[{
RDFTriple[ex["maria"], ex["age"], 39],
RDFTriple[ex["maria"], ex["hasParent"], ex["jesus"]],
RDFTriple[ex["jesus"], ex["age"], 64]
}];主語と目的語のペアを辺とし述語を辺のタグとしてGraphを作る:
personStore//SPARQLSelect[
RDFTriple[SPARQLVariable["s"], SPARQLVariable["p"], SPARQLVariable["o"]]
]//Map[Function[
DirectedEdge[#s, #o, #p]
]]//Graph[#, VertexLabels -> "Name", ImageSize -> Medium]&Needs["GraphStore`"]辺にタグを付けてGraphを指定する:
g = Graph[{
DirectedEdge["a", "b", "p1"],
DirectedEdge["b", "c", "p1"],
DirectedEdge["c", "a", "p2"]
}, VertexLabels -> Automatic, EdgeLabels -> Automatic]ex[s_] := URL["http://example.org/" <> s];RDFStore[
Function[{u, v, t},
RDFTriple[ex[u], ex[t], ex[v]]
]@@@EdgeList[g]
]%["DefaultGraph"]関連するガイド
テキスト
Wolfram Research (2019), RDFStore, Wolfram言語関数, https://reference.wolfram.com/language/GraphStore/ref/RDFStore.html.
CMS
Wolfram Language. 2019. "RDFStore." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/RDFStore.html.
APA
Wolfram Language. (2019). RDFStore. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphStore/ref/RDFStore.html
BibTeX
@misc{reference.wolfram_2026_rdfstore, author="Wolfram Research", title="{RDFStore}", year="2019", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/RDFStore.html}", note=[Accessed: 12-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_rdfstore, organization={Wolfram Research}, title={RDFStore}, year={2019}, url={https://reference.wolfram.com/language/GraphStore/ref/RDFStore.html}, note=[Accessed: 12-August-2026]}