SPARQLEntailmentRegime
is an option for SPARQLQuery that specifies which entailment relations to use when evaluating a query.
SPARQLEntailmentRegime
SPARQLEntailmentRegime
is an option for SPARQLQuery that specifies which entailment relations to use when evaluating a query.
范例
打开所有单元 关闭所有单元基本范例 (1)
Needs["GraphStore`"]Specify a hierarchy of professions using the RDF Schema vocabulary:
rdfs[s_] := URL["http://www.w3.org/2000/01/rdf-schema#" <> s];
ex[s_] := URL["http://example.org/" <> s];data = RDFStore[{
RDFTriple[ex["Singer"], rdfs["subClassOf"], ex["Musician"]],
RDFTriple[ex["Musician"], rdfs["subClassOf"], ex["Person"]]
}];Find all sub-classes of "Person" using "RDFS" entailment:
data//SPARQLQuery[
SPARQLSelect[RDFTriple[SPARQLVariable["c"], rdfs["subClassOf"], ex["Person"]]],
SPARQLEntailmentRegime -> "RDFS"
]Without entailment the same query has only one solution:
data//SPARQLSelect[RDFTriple[SPARQLVariable["c"], rdfs["subClassOf"], ex["Person"]]]Scope (1)
Needs["GraphStore`"]Import an ontology of topological spaces:
topologyStore = ImportString["
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix owl: <http://www.w3.org/2002/07/owl#>
prefix : <http://example.org/>
# individuals
:space1 a owl:NamedIndividual,
:TopologicalSpace ,
:HausdorffSpace ,
[a owl:Class ; owl:complementOf :T3Space] .
:space2 a owl:NamedIndividual ,
:TopologicalSpace ,
:RegularSpace .
:space3 a owl:NamedIndividual ,
:TopologicalSpace ,
:T1Space ,
:T3Space .
:space4 a owl:NamedIndividual ,
:TopologicalSpace ,
[a owl:Class ; owl:complementOf :T1Space] .
[a owl:AllDifferent ; owl:members (:space1 :space2 :space3 :space4)] .
# classes
:TopologicalSpace a owl:Class .
:HausdorffSpace a owl:Class ;
rdfs:subClassOf :TopologicalSpace .
:RegularSpace a owl:Class ;
rdfs:subClassOf :TopologicalSpace .
:T1Space a owl:Class ;
rdfs:subClassOf :TopologicalSpace .
:T3Space a owl:Class ;
rdfs:subClassOf :TopologicalSpace .
# theorems
:RegularSpace
owl:equivalentClass [a owl:Class ; owl:intersectionOf (:T1Space :T3Space)] .
:RegularSpace rdfs:subClassOf :HausdorffSpace .
:HausdorffSpace rdfs:subClassOf :T1Space .
", "Turtle"]rdf[s_] := URL["http://www.w3.org/1999/02/22-rdf-syntax-ns#" <> s];
owl[s_] := URL["http://www.w3.org/2002/07/owl#" <> s];
ex[s_] := URL["http://example.org/" <> s];Space 3 is not explicitly declared to be regular:
topologyStore//SPARQLAsk[RDFTriple[ex["space3"], rdf["type"], ex["RegularSpace"]]]Space 3 can be inferred to be regular under the OWL 2 direct semantics:
topologyStore//SPARQLQuery[
SPARQLAsk[RDFTriple[ex["space3"], rdf["type"], ex["RegularSpace"]]],
SPARQLEntailmentRegime -> "OWLDirect"
]Find all T1 spaces, including inferred members:
topologyStore//SPARQLQuery[
SPARQLSelect[RDFTriple[SPARQLVariable["space"], rdf["type"], ex["T1Space"]]],
SPARQLEntailmentRegime -> "OWLDirect"
]Find Hausdorff spaces which are not regular:
topologyStore//SPARQLQuery[
SPARQLSelect[{
RDFTriple[SPARQLVariable["space"], rdf["type"], RDFBlankNode["i"]],
RDFTriple[RDFBlankNode["i"], rdf["type"], owl["Class"]],
RDFTriple[RDFBlankNode["i"], owl["intersectionOf"], RDFCollection[{ex["HausdorffSpace"], RDFBlankNode["c"]}]],
RDFTriple[RDFBlankNode["c"], rdf["type"], owl["Class"]],
RDFTriple[RDFBlankNode["c"], owl["complementOf"], ex["RegularSpace"]]
}],
SPARQLEntailmentRegime -> "OWLDirect"
]Space 4 can't be inferred to be a T3 space:
topologyStore//SPARQLQuery[
SPARQLAsk[RDFTriple[ex["space4"], rdf["type"], ex["T3Space"]]],
SPARQLEntailmentRegime -> "OWLDirect"
]The opposite, space 4 being in the complement of T3 spaces, can't be inferred either:
topologyStore//SPARQLQuery[
SPARQLAsk[{
RDFTriple[ex["space4"], rdf["type"], RDFBlankNode["c"]],
RDFTriple[RDFBlankNode["c"], rdf["type"], owl["Class"]],
RDFTriple[RDFBlankNode["c"], owl["complementOf"], ex["T3Space"]]
}],
SPARQLEntailmentRegime -> "OWLDirect"
]文本
Wolfram Research (2020),SPARQLEntailmentRegime,Wolfram 语言函数,https://reference.wolfram.com/language/GraphStore/ref/SPARQLEntailmentRegime.html.
CMS
Wolfram 语言. 2020. "SPARQLEntailmentRegime." Wolfram 语言与系统参考资料中心. Wolfram Research. https://reference.wolfram.com/language/GraphStore/ref/SPARQLEntailmentRegime.html.
APA
Wolfram 语言. (2020). SPARQLEntailmentRegime. Wolfram 语言与系统参考资料中心. 追溯自 https://reference.wolfram.com/language/GraphStore/ref/SPARQLEntailmentRegime.html 年
BibTeX
@misc{reference.wolfram_2026_sparqlentailmentregime, author="Wolfram Research", title="{SPARQLEntailmentRegime}", year="2020", howpublished="\url{https://reference.wolfram.com/language/GraphStore/ref/SPARQLEntailmentRegime.html}", note=[Accessed: 17-August-2026]}
BibLaTeX
@online{reference.wolfram_2026_sparqlentailmentregime, organization={Wolfram Research}, title={SPARQLEntailmentRegime}, year={2020}, url={https://reference.wolfram.com/language/GraphStore/ref/SPARQLEntailmentRegime.html}, note=[Accessed: 17-August-2026]}