-- 作者:zfsrt
-- 发布时间:3/9/2008 2:19:00 PM
-- 求助,sparql查询owl问题!
下面是一个owl文件,我要查询出这个文件中的Year=2001,month>1的类SST中的实例应该怎么写? 通过朋友指教,我想应该是这样写: select ?s where { ?s tp:type ?SST ?? pro:property ?month filter(month>2). ?s pro:property ?Year filter(Year=2001). } 但是对于命名空间等东西,我不太懂,因此我不知道上面写法中的tp:type以及 pro:property在下面的这个具体例子中应该怎么写? 请各位高手多多指教!在下不尽感谢! <?xml version="1.0"?> <rdf:RDF xmlns="http://www.owl-ontologies.com/OceanOntology#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" xmlns:owl="http://www.w3.org/2002/07/owl#" xml:base="http://www.owl-ontologies.com/OceanOntology" > <rdf:Description rdf:about="#SST"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/> </rdf:Description> <rdf:Description rdf:nodeID="A0"> <rdf:first rdf:resource="#RAIN"/> <rdf:rest rdf:nodeID="A1"/> </rdf:Description> <rdf:Description rdf:about=""> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Ontology"/> </rdf:Description> <rdf:Description rdf:about="#ERST_10"> <Latitude rdf:datatype="http://www.w3.org/2001/XMLSchema#float">120.0</Latitude> <Month rdf:datatype="http://www.w3.org/2001/XMLSchema#int">3</Month> <rdf:type rdf:resource="#ERST"/> <Year rdf:datatype="http://www.w3.org/2001/XMLSchema#int">2001</Year> </rdf:Description> <rdf:Description rdf:nodeID="A2"> <rdf:rest rdf:nodeID="A3"/> <rdf:first rdf:resource="#RAIN"/> </rdf:Description> <rdf:Description rdf:about="#RAIN"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/> </rdf:Description> <rdf:Description rdf:about="#ERST_9"> <rdf:type rdf:resource="#ERST"/> <Year rdf:datatype="http://www.w3.org/2001/XMLSchema#int">2000</Year> <Month rdf:datatype="http://www.w3.org/2001/XMLSchema#int">2</Month> <Latitude rdf:datatype="http://www.w3.org/2001/XMLSchema#float">100.0</Latitude> </rdf:Description> <rdf:Description rdf:nodeID="A3"> <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/> <rdf:first rdf:resource="#SST"/> </rdf:Description> <rdf:Description rdf:nodeID="A1"> <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/> <rdf:first rdf:resource="#SST"/> </rdf:Description> <rdf:Description rdf:about="#Month"> <rdfs:domain rdf:nodeID="A4"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/> </rdf:Description> <rdf:Description rdf:nodeID="A5"> <rdf:rest rdf:nodeID="A6"/> <rdf:first rdf:resource="#RAIN"/> </rdf:Description> <rdf:Description rdf:nodeID="A7"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/> <owl:unionOf rdf:nodeID="A5"/> </rdf:Description> <rdf:Description rdf:about="#Latitude"> <rdfs:domain rdf:nodeID="A8"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#float"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/> </rdf:Description> <rdf:Description rdf:about="#MSLA"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/> <rdfs:subClassOf rdf:resource="#SST"/> </rdf:Description> <rdf:Description rdf:nodeID="A6"> <rdf:first rdf:resource="#SST"/> <rdf:rest rdf:resource="http://www.w3.org/1999/02/22-rdf-syntax-ns#nil"/> </rdf:Description> <rdf:Description rdf:about="#Year"> <rdfs:domain rdf:nodeID="A7"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#DatatypeProperty"/> <rdfs:range rdf:resource="http://www.w3.org/2001/XMLSchema#int"/> </rdf:Description> <rdf:Description rdf:about="#ERST"> <rdfs:subClassOf rdf:resource="#SST"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/> </rdf:Description> <rdf:Description rdf:nodeID="A4"> <owl:unionOf rdf:nodeID="A2"/> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/> </rdf:Description> <rdf:Description rdf:nodeID="A8"> <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#Class"/> <owl:unionOf rdf:nodeID="A0"/> </rdf:Description> </rdf:RDF> <!-- Created with Protege (with OWL Plugin 3.3, Build 390) http://protege.stanford.edu --> [此贴子已经被作者于2008-3-10 8:59:03编辑过]
|