SPARQL 查询不显示结果
SPARQL query not displaying results
我对语义 Web 编程还很陌生。我有一个 OWL 文件,我已将其加载到 URI http://myexample.com
的 Virtuoso 服务器中。现在,当我打开 Virtuoso SPARQL 查询编辑器 (http://localhost:8890/sparql
) 和 运行 以下查询时,我没有得到任何结果:
SELECT ?class FROM <myexample.com> WHERE{?class a owl:class} Order By ?class
这是我的 OWL 文件:
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY Antibiotics "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#" >
<!ENTITY Antibiotics2 "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#2" >
<!ENTITY Antibiotics3 "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#1" >
<!ENTITY Antibiotics4 "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#3" >
<!ENTITY Traveler "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Traveler'" >
]>
<rdf:RDF xmlns="http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#"
xml:base="http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
xmlns:Antibiotics2="&Antibiotics;2"
xmlns:Traveler="&Antibiotics;Traveler'"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:Antibiotics="http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#"
xmlns:Antibiotics3="&Antibiotics;1"
xmlns:Antibiotics4="&Antibiotics;3">
<owl:Ontology rdf:about=""/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#cures_disease -->
<owl:ObjectProperty rdf:about="#cures_disease">
<rdfs:label>cures_disease</rdfs:label>
<rdfs:domain rdf:resource="#Antibiotics"/>
<rdfs:range rdf:resource="#Diseases"/>
</owl:ObjectProperty>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#has_SideEffects -->
<owl:ObjectProperty rdf:about="#has_SideEffects">
<rdfs:label>has_SideEffects</rdfs:label>
<rdfs:domain rdf:resource="#Antibiotics"/>
<rdfs:range rdf:resource="#SideEffects"/>
</owl:ObjectProperty>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#1st_Generation -->
<owl:Class rdf:about="#1st_Generation">
<rdfs:label>1st_Generation</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#2nd_Generation -->
<owl:Class rdf:about="#2nd_Generation">
<rdfs:label>2nd_Generation</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#3rd_Generation -->
<owl:Class rdf:about="#3rd_Generation">
<rdfs:label>3rd_Generation</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Aminopenicillins -->
<owl:Class rdf:about="#Aminopenicillins">
<rdfs:label
>Aminopenicillins</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Antibiotics -->
<owl:Class rdf:about="#Antibiotics">
<rdfs:label>Antibiotics</rdfs:label>
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Diseases -->
<owl:Class rdf:about="#Diseases">
<rdfs:label>Diseases</rdfs:label>
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Lincosamide -->
<owl:Class rdf:about="#Lincosamide">
<rdfs:label>Lincosamide</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#SideEffects -->
<owl:Class rdf:about="#SideEffects">
<rdfs:label>SideEffects</rdfs:label>
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
</owl:Class>
<!-- http://www.w3.org/2002/07/owl#Thing -->
<owl:Class rdf:about="&owl;Thing"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Acne -->
<Diseases rdf:about="#Acne">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label>Acne</rdfs:label>
</Diseases>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Allergic_Reactions -->
<owl:Thing rdf:about="#Allergic_Reactions">
<rdf:type rdf:resource="#SideEffects"/>
<rdfs:label
>Allergic_Reactions</rdfs:label>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Amoxicillin -->
<owl:Thing rdf:about="#Amoxicillin">
<rdf:type rdf:resource="#Aminopenicillins"/>
<rdfs:label>Amoxicillin</rdfs:label>
<has_SideEffects rdf:resource="#Diarrhea"/>
<cures_disease rdf:resource="#Wide_Range_Of_Infections"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Cefalexin -->
<owl:Thing rdf:about="#Cefalexin">
<rdf:type rdf:resource="#1st_Generation"/>
<rdfs:label>Cephalexin</rdfs:label>
<cures_disease rdf:resource="#Gram_positive_infections"/>
<has_SideEffects rdf:resource="#Nausea"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Cefazolin -->
<Antibiotics3:st_Generation rdf:about="#Cefazolin">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label>Cefazolin</rdfs:label>
<has_SideEffects rdf:resource="#Allergic_Reactions"/>
<cures_disease rdf:resource="#Gram_positive_infections"/>
</Antibiotics3:st_Generation>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Cefepime -->
<owl:Thing rdf:about="#Cefepime">
<rdf:type rdf:resource="#3rd_Generation"/>
<rdfs:label>Cefepime</rdfs:label>
<has_SideEffects rdf:resource="#Nausea"/>
<cures_disease rdf:resource="#Pseudomonal_Infections"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Cefoxitin -->
<Antibiotics2:nd_Generation rdf:about="#Cefoxitin">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label>Cefoxitin</rdfs:label>
<has_SideEffects rdf:resource="#Allergic_Reactions"/>
<cures_disease rdf:resource="#Gram_negative_cover"/>
</Antibiotics2:nd_Generation>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Clindamycin -->
<owl:Thing rdf:about="#Clindamycin">
<rdf:type rdf:resource="#Lincosamide"/>
<rdfs:label>Clindamycin</rdfs:label>
<cures_disease rdf:resource="#Acne"/>
<has_SideEffects rdf:resource="#Diarrhea"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Diarrhea -->
<owl:Thing rdf:about="#Diarrhea">
<rdf:type rdf:resource="#SideEffects"/>
<rdfs:label>Diarrhea</rdfs:label>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Gastrointestinal_Upset -->
<SideEffects rdf:about="#Gastrointestinal_Upset">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label
>Gastrointestinal_Upset</rdfs:label>
</SideEffects>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Gram_negative_cover -->
<owl:Thing rdf:about="#Gram_negative_cover">
<rdf:type rdf:resource="#Diseases"/>
<rdfs:label
>Gram_negative_cover</rdfs:label>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Gram_positive_infections -->
<owl:Thing rdf:about="#Gram_positive_infections">
<rdf:type rdf:resource="#Diseases"/>
<rdfs:label
>Gram_positive_infections</rdfs:label>
<cures_disease rdf:resource="#Gram_positive_infections"/>
<has_SideEffects rdf:resource="#Nausea"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Nausea -->
<owl:Thing rdf:about="#Nausea">
<rdf:type rdf:resource="#SideEffects"/>
<rdfs:label>Nausea</rdfs:label>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Pseudomonal_Infections -->
<Diseases rdf:about="#Pseudomonal_Infections">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label
>Pseudomonal_Infections</rdfs:label>
</Diseases>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Wide_Range_Of_Infections -->
<owl:Thing rdf:about="#Wide_Range_Of_Infections">
<rdf:type rdf:resource="#Diseases"/>
<rdfs:label
>Wide_Range_Of_Infections</rdfs:label>
</owl:Thing>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// General axioms
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<rdf:Description>
<rdf:type rdf:resource="&owl;AllDisjointClasses"/>
<owl:members rdf:parseType="Collection">
<rdf:Description rdf:about="#Antibiotics"/>
<rdf:Description rdf:about="#Diseases"/>
<rdf:Description rdf:about="#SideEffects"/>
</owl:members>
</rdf:Description>
<rdf:Description>
<rdf:type rdf:resource="&owl;AllDisjointClasses"/>
<owl:members rdf:parseType="Collection">
<rdf:Description rdf:about="#1st_Generation"/>
<rdf:Description rdf:about="#2nd_Generation"/>
<rdf:Description rdf:about="#3rd_Generation"/>
<rdf:Description rdf:about="#Aminopenicillins"/>
<rdf:Description rdf:about="#Lincosamide"/>
</owl:members>
</rdf:Description>
</rdf:RDF>
<!-- Generated by the OWL API (version 2.2.1.1138) http://owlapi.sourceforge.net -->
IRI 区分大小写。请注意,在您的 ontology owl:Class 中使用了大括号 C:
<owl:Class rdf:about="#1st_Generation">
<rdfs:label>1st_Generation</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
在您的 SPARQL 查询中也需要如此。而且,如果您没有其他地方,则需要定义前缀。如果您将数据存储在名为 http://myexample.com 的图表中,那么您可能需要 select 从中,确切地说, 来自 。不要删除 http:// 前缀。我下载了您的数据,此查询产生了以下结果:
prefix owl: <http://www.w3.org/2002/07/owl#>
select ?class where {
?class a owl:Class
}
---------------------------------------------------------------------------------------------
| class |
=============================================================================================
| owl:Thing |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#SideEffects> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Lincosamide> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Diseases> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Antibiotics> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Aminopenicillins> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#3rd_Generation> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#2nd_Generation> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#1st_Generation> |
---------------------------------------------------------------------------------------------
我对语义 Web 编程还很陌生。我有一个 OWL 文件,我已将其加载到 URI http://myexample.com
的 Virtuoso 服务器中。现在,当我打开 Virtuoso SPARQL 查询编辑器 (http://localhost:8890/sparql
) 和 运行 以下查询时,我没有得到任何结果:
SELECT ?class FROM <myexample.com> WHERE{?class a owl:class} Order By ?class
这是我的 OWL 文件:
<?xml version="1.0"?>
<!DOCTYPE rdf:RDF [
<!ENTITY owl "http://www.w3.org/2002/07/owl#" >
<!ENTITY xsd "http://www.w3.org/2001/XMLSchema#" >
<!ENTITY owl2xml "http://www.w3.org/2006/12/owl2-xml#" >
<!ENTITY rdfs "http://www.w3.org/2000/01/rdf-schema#" >
<!ENTITY rdf "http://www.w3.org/1999/02/22-rdf-syntax-ns#" >
<!ENTITY Antibiotics "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#" >
<!ENTITY Antibiotics2 "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#2" >
<!ENTITY Antibiotics3 "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#1" >
<!ENTITY Antibiotics4 "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#3" >
<!ENTITY Traveler "http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Traveler'" >
]>
<rdf:RDF xmlns="http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#"
xml:base="http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:owl2xml="http://www.w3.org/2006/12/owl2-xml#"
xmlns:Antibiotics2="&Antibiotics;2"
xmlns:Traveler="&Antibiotics;Traveler'"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:Antibiotics="http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#"
xmlns:Antibiotics3="&Antibiotics;1"
xmlns:Antibiotics4="&Antibiotics;3">
<owl:Ontology rdf:about=""/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Object Properties
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#cures_disease -->
<owl:ObjectProperty rdf:about="#cures_disease">
<rdfs:label>cures_disease</rdfs:label>
<rdfs:domain rdf:resource="#Antibiotics"/>
<rdfs:range rdf:resource="#Diseases"/>
</owl:ObjectProperty>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#has_SideEffects -->
<owl:ObjectProperty rdf:about="#has_SideEffects">
<rdfs:label>has_SideEffects</rdfs:label>
<rdfs:domain rdf:resource="#Antibiotics"/>
<rdfs:range rdf:resource="#SideEffects"/>
</owl:ObjectProperty>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Classes
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#1st_Generation -->
<owl:Class rdf:about="#1st_Generation">
<rdfs:label>1st_Generation</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#2nd_Generation -->
<owl:Class rdf:about="#2nd_Generation">
<rdfs:label>2nd_Generation</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#3rd_Generation -->
<owl:Class rdf:about="#3rd_Generation">
<rdfs:label>3rd_Generation</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Aminopenicillins -->
<owl:Class rdf:about="#Aminopenicillins">
<rdfs:label
>Aminopenicillins</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Antibiotics -->
<owl:Class rdf:about="#Antibiotics">
<rdfs:label>Antibiotics</rdfs:label>
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Diseases -->
<owl:Class rdf:about="#Diseases">
<rdfs:label>Diseases</rdfs:label>
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Lincosamide -->
<owl:Class rdf:about="#Lincosamide">
<rdfs:label>Lincosamide</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#SideEffects -->
<owl:Class rdf:about="#SideEffects">
<rdfs:label>SideEffects</rdfs:label>
<rdfs:subClassOf rdf:resource="&owl;Thing"/>
</owl:Class>
<!-- http://www.w3.org/2002/07/owl#Thing -->
<owl:Class rdf:about="&owl;Thing"/>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// Individuals
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Acne -->
<Diseases rdf:about="#Acne">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label>Acne</rdfs:label>
</Diseases>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Allergic_Reactions -->
<owl:Thing rdf:about="#Allergic_Reactions">
<rdf:type rdf:resource="#SideEffects"/>
<rdfs:label
>Allergic_Reactions</rdfs:label>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Amoxicillin -->
<owl:Thing rdf:about="#Amoxicillin">
<rdf:type rdf:resource="#Aminopenicillins"/>
<rdfs:label>Amoxicillin</rdfs:label>
<has_SideEffects rdf:resource="#Diarrhea"/>
<cures_disease rdf:resource="#Wide_Range_Of_Infections"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Cefalexin -->
<owl:Thing rdf:about="#Cefalexin">
<rdf:type rdf:resource="#1st_Generation"/>
<rdfs:label>Cephalexin</rdfs:label>
<cures_disease rdf:resource="#Gram_positive_infections"/>
<has_SideEffects rdf:resource="#Nausea"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Cefazolin -->
<Antibiotics3:st_Generation rdf:about="#Cefazolin">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label>Cefazolin</rdfs:label>
<has_SideEffects rdf:resource="#Allergic_Reactions"/>
<cures_disease rdf:resource="#Gram_positive_infections"/>
</Antibiotics3:st_Generation>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Cefepime -->
<owl:Thing rdf:about="#Cefepime">
<rdf:type rdf:resource="#3rd_Generation"/>
<rdfs:label>Cefepime</rdfs:label>
<has_SideEffects rdf:resource="#Nausea"/>
<cures_disease rdf:resource="#Pseudomonal_Infections"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Cefoxitin -->
<Antibiotics2:nd_Generation rdf:about="#Cefoxitin">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label>Cefoxitin</rdfs:label>
<has_SideEffects rdf:resource="#Allergic_Reactions"/>
<cures_disease rdf:resource="#Gram_negative_cover"/>
</Antibiotics2:nd_Generation>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Clindamycin -->
<owl:Thing rdf:about="#Clindamycin">
<rdf:type rdf:resource="#Lincosamide"/>
<rdfs:label>Clindamycin</rdfs:label>
<cures_disease rdf:resource="#Acne"/>
<has_SideEffects rdf:resource="#Diarrhea"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Diarrhea -->
<owl:Thing rdf:about="#Diarrhea">
<rdf:type rdf:resource="#SideEffects"/>
<rdfs:label>Diarrhea</rdfs:label>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Gastrointestinal_Upset -->
<SideEffects rdf:about="#Gastrointestinal_Upset">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label
>Gastrointestinal_Upset</rdfs:label>
</SideEffects>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Gram_negative_cover -->
<owl:Thing rdf:about="#Gram_negative_cover">
<rdf:type rdf:resource="#Diseases"/>
<rdfs:label
>Gram_negative_cover</rdfs:label>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Gram_positive_infections -->
<owl:Thing rdf:about="#Gram_positive_infections">
<rdf:type rdf:resource="#Diseases"/>
<rdfs:label
>Gram_positive_infections</rdfs:label>
<cures_disease rdf:resource="#Gram_positive_infections"/>
<has_SideEffects rdf:resource="#Nausea"/>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Nausea -->
<owl:Thing rdf:about="#Nausea">
<rdf:type rdf:resource="#SideEffects"/>
<rdfs:label>Nausea</rdfs:label>
</owl:Thing>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Pseudomonal_Infections -->
<Diseases rdf:about="#Pseudomonal_Infections">
<rdf:type rdf:resource="&owl;Thing"/>
<rdfs:label
>Pseudomonal_Infections</rdfs:label>
</Diseases>
<!-- http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Wide_Range_Of_Infections -->
<owl:Thing rdf:about="#Wide_Range_Of_Infections">
<rdf:type rdf:resource="#Diseases"/>
<rdfs:label
>Wide_Range_Of_Infections</rdfs:label>
</owl:Thing>
<!--
///////////////////////////////////////////////////////////////////////////////////////
//
// General axioms
//
///////////////////////////////////////////////////////////////////////////////////////
-->
<rdf:Description>
<rdf:type rdf:resource="&owl;AllDisjointClasses"/>
<owl:members rdf:parseType="Collection">
<rdf:Description rdf:about="#Antibiotics"/>
<rdf:Description rdf:about="#Diseases"/>
<rdf:Description rdf:about="#SideEffects"/>
</owl:members>
</rdf:Description>
<rdf:Description>
<rdf:type rdf:resource="&owl;AllDisjointClasses"/>
<owl:members rdf:parseType="Collection">
<rdf:Description rdf:about="#1st_Generation"/>
<rdf:Description rdf:about="#2nd_Generation"/>
<rdf:Description rdf:about="#3rd_Generation"/>
<rdf:Description rdf:about="#Aminopenicillins"/>
<rdf:Description rdf:about="#Lincosamide"/>
</owl:members>
</rdf:Description>
</rdf:RDF>
<!-- Generated by the OWL API (version 2.2.1.1138) http://owlapi.sourceforge.net -->
IRI 区分大小写。请注意,在您的 ontology owl:Class 中使用了大括号 C:
<owl:Class rdf:about="#1st_Generation">
<rdfs:label>1st_Generation</rdfs:label>
<rdfs:subClassOf rdf:resource="#Antibiotics"/>
</owl:Class>
在您的 SPARQL 查询中也需要如此。而且,如果您没有其他地方,则需要定义前缀。如果您将数据存储在名为 http://myexample.com 的图表中,那么您可能需要 select 从中,确切地说, 来自
prefix owl: <http://www.w3.org/2002/07/owl#>
select ?class where {
?class a owl:Class
}
---------------------------------------------------------------------------------------------
| class |
=============================================================================================
| owl:Thing |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#SideEffects> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Lincosamide> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Diseases> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Antibiotics> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#Aminopenicillins> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#3rd_Generation> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#2nd_Generation> |
| <http://www.semanticweb.org/uthejsree/ontologies/2014/8/Antibiotics.owl#1st_Generation> |
---------------------------------------------------------------------------------------------