我做了这个本体论:
SensorOntology:MedicalCabinet-01 rdf:type owl:NamedIndividual ,
SensorOntology:MedicalCabinetSensor ;
SensorOntology:hasId "57"^^xsd:int ;
SensorOntology:hasValue "0"^^xsd:int .
我正在尝试编写一个查询来获取 MedicalCabinet-01 的类型 MedicalCabinetSensor 给定的 id 号码。但是,我正在打印 owl:NamedIndividual 和 SensorOntology:MedicalCabinetSensor 。无论如何我只打印 SensorOntology:MedicalCabinetSensor 。这是我的问题:
SELECT DISTINCT ?sensor ?sensorclass
WHERE {?sensor :hasId "100"^^xsd:int.
?sensor rdf:type ?sensorclass}
答案 0 :(得分:1)
确实,有多种方式。这是另一个:
SELECT DISTINCT ?sensor ?sensorclass
WHERE {?sensor :hasId "100"^^xsd:int.
?sensor rdf:type ?sensorclass
FILTER ( strstarts(str(?sensorclass), "[sensor ontology URI]") )
}