SPARQLPropertyPath[start, {p1,p2,…}, end]
主語 start から始まり,述語 piの辺を訪れ,目的語 end で終る,RDFグラフのパスを表すパターンオブジェクトである.
SPARQLPropertyPath
SPARQLPropertyPath[start, {p1,p2,…}, end]
主語 start から始まり,述語 piの辺を訪れ,目的語 end で終る,RDFグラフのパスを表すパターンオブジェクトである.
詳細とオプション
- 各 piは述語URLまたはパターンでよい.
- 引数 start および end はURLまたはSPARQLVariableでよく,end は数または文字列のようなリテラルでよい.
- MatchQ[{f1,f2,…},{p1,p2,…}]がTrueを返し start がSPARQLVariableまたは a で end がSPARQLVariableまたは z なら,SPARQLPropertyPath[start,{p1,p2,…},end]はパス{RDFTriple[a,f1,b],RDFTriple[b,f2,c],…,RDFTriple[y,f2,z]}と一致する.
- piは,次の形の任意の組合せでよい.
-
URL[…] 述語パス SPARQLInverseProperty[…] 逆のパス Sequence[…] シーケンスパス Alternatives[…] (|) 代替パス RepeatedNull[…] (...) ゼロ以上のパス Repeated[…] (..) 1つ以上のパス Repeated[…,{0,1}] ゼロまたは1つのパス Except[…] 否定された特性集合(述語,逆述語,その代替についてのみ)
例題
すべて開く すべて閉じる例 (1)
Needs["GraphStore`"]ex[s_] := URL["http://example.org/" <> s];familyGraph = RDFStore[{
RDFTriple[ex["scarlett"], ex["hasFather"], ex["john"]],
RDFTriple[ex["scarlett"], ex["hasMother"], ex["lily"]],
RDFTriple[ex["scarlett"], ex["hasHobby"], ex["swimming"]],
RDFTriple[ex["john"], ex["hasFather"], ex["james"]],
RDFTriple[ex["john"], ex["hasMother"], ex["nora"]],
RDFTriple[ex["john"], ex["hasHobby"], ex["volleyball"]],
RDFTriple[ex["lily"], ex["hasFather"], ex["alex"]],
RDFTriple[ex["lily"], ex["hasMother"], ex["stella"]]
}];familyGraph//SPARQLSelect[
SPARQLPropertyPath[ex["scarlett"], {ex["hasFather"] | ex["hasMother"], ex["hasFather"] | ex["hasMother"]}, SPARQLVariable["grandParent"]]
]familyGraph//SPARQLSelect[{
RDFTriple[ex["scarlett"], ex["hasFather"], SPARQLVariable["parent"]] | RDFTriple[ex["scarlett"], ex["hasMother"], SPARQLVariable["parent"]],
RDFTriple[SPARQLVariable["parent"], ex["hasFather"], SPARQLVariable["grandParent"]] | RDFTriple[SPARQLVariable["parent"], ex["hasMother"], SPARQLVariable["grandParent"]]
} -> "grandParent"]スコープ (1)
Needs["GraphStore`"]人と人との関係と,使用された特性がどのように関係するかを指定する:
rdfs[s_] := URL["http://www.w3.org/2000/01/rdf-schema#"];
ex[s_] := URL["http://example.org/" <> s];friendsGraph = RDFStore[{
(* vocabulary *)
RDFTriple[ex["hasGoodFriend"], rdfs["subPropertyOf"], ex["hasFriend"]],
(* data *)
RDFTriple[ex["bob"], ex["hasFriend"], ex["alice"]],
RDFTriple[ex["bob"], ex["hasGoodFriend"], ex["frank"]],
RDFTriple[ex["alice"], ex["hasFriend"], ex["carl"]]
}];friendsGraph//SPARQLSelect[{
RDFTriple[ex["bob"], SPARQLVariable["friendProp"] , SPARQLVariable["friend"]],
SPARQLPropertyPath[SPARQLVariable["friendProp"], {rdfs["subPropertyOf"]...}, ex["hasFriend"]]
}]関連するガイド
テキスト
Wolfram Research (2019), SPARQLPropertyPath, Wolfram言語関数, https://reference.wolfram.com/language/GraphStore/ref/SPARQLPropertyPath.html.
CMS
Wolfram Language. 2019. "SPARQLPropertyPath." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLPropertyPath.html.
APA
Wolfram Language. (2019). SPARQLPropertyPath. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/GraphStore/ref/SPARQLPropertyPath.html
BibTeX
@misc{reference.wolfram_2026_sparqlpropertypath, author="Wolfram Research", title="{SPARQLPropertyPath}", year="2019", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/SPARQLPropertyPath.html}", note=[Accessed: 12-July-2026]}
BibLaTeX
@online{reference.wolfram_2026_sparqlpropertypath, organization={Wolfram Research}, title={SPARQLPropertyPath}, year={2019}, url={https://reference.wolfram.com/language/GraphStore/ref/SPARQLPropertyPath.html}, note=[Accessed: 12-July-2026]}