使用 Protoge 中的 SPARQL 查询选项卡查询我自己 ontology 中的元素

Using the SPARQL Query tab in Protoge to query elements within my own ontology

我有一个 ontology,我正在尝试对其进行 qrite SPARQL 查询。

我正在使用显示在活动 ontology 选项卡上的 Ontology IRI (http://www.semanticweb.org/chris/ontologies/2020/2/dis-coursework-ontology) 来定义以下查询中的 PREFIX 值:

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX chris: <http://www.semanticweb.org/chris/ontologies/2020/2/dis-coursework-ontology#>

SELECT ?class ?activity
    WHERE { ?class chris:hasActivity ?activity }

当我 运行 什么都没有返回时,但是当我将 ontology 输出为 RDF 格式时,我可以看到我想要返回的实例:

<owl:Class rdf:about="http://www.semanticweb.org/chris/ontologies/2020/2/dis-coursework-ontology#SportsHallBooking">
        <rdfs:subClassOf rdf:resource="http://www.semanticweb.org/chris/ontologies/2020/2/dis-coursework-ontology#BookableTimetable"/>
        <rdfs:subClassOf>
                <owl:Restriction>
                        <owl:onProperty rdf:resource="http://www.semanticweb.org/chris/ontologies/2020/2/dis-coursework-ontology#hasActivity"/>
                        <owl:someValuesFrom rdf:resource="http://www.semanticweb.org/chris/ontologies/2020/2/dis-coursework-ontology#Badminton"/>
                </owl:Restriction>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
        </rdfs:subClassOf>
        <rdfs:subClassOf>
                <owl:Restriction>
                        <owl:onProperty rdf:resource="http://www.semanticweb.org/chris/ontologies/2020/2/dis-coursework-ontology#hasActivity"/>
                        <owl:someValuesFrom rdf:resource="http://www.semanticweb.org/chris/ontologies/2020/2/dis-coursework-ontology#Football"/>
                </owl:Restriction>
        </rdfs:subClassOf>
</owl:Class>

所以我希望结果包括:

class | activity
SportsHallBooking | Badminton
SportsHallBooking | Football

但我什么也没得到。

答案归功于 Stanislav。

select * { ?class rdfs:subClassOf [ owl:onProperty chris:hasActivity; owl:someValuesFrom ?activity ] }