我有如下 RDF/Turtle 资源:
@prefix factory: <http://linkedfactory.iwu.fraunhofer.de/vocab#> .
@prefix : <http://linkedfactory.iwu.fraunhofer.de/data/> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://linkedfactory.iwu.fraunhofer.de/linkedfactory> factory:contains <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/demofactory> .
<http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU> factory:contains <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/Rollex> .
<http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim> factory:contains <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab> .
<http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab> factory:contains <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/Aximus> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/BDM2000> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/Fliesspressen> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/GMX_Entgraten> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/GMX_Spanen1> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/GMX_Spanen2> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/GMX_Spanen3> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/GMX_Spanen4> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/HA100> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/Karobau> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/PRD40> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/PWZ> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/Querwalzen> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/E3-Sim/FoFab/Rollex> .
<http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab> factory:contains <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/BHKW> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/GLT> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/GMX> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/NSHV> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/NSHV-Buero> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/Rollex> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/SolarPlant> .
<http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/BHKW> factory:contains <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/BHKW/CoolingWater> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/BHKW/EmergencyCooling> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/BHKW/Generator> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/BHKW/HeatMeter> , <http://linkedfactory.iwu.fraunhofer.de/linkedfactory/IWU/FoFab/BHKW/HeatingWater> .
对于以下情况,我使用选区解析器从自然语言转换为 Sparql 请求
问题:linkedfactory包含什么?
PREFIX vocab: <http://linkedfactory.iwu.fraunhofer.de/vocab#>
select * where {
<http://localhost:10080/linkedfactory/demofactory> vocab:contains ?o .
}
对于以下问题,如果“包含”动词出现在名词“linkedfactory”之前,我需要检测它。
问题:什么包含linkedfactory?或者你能告诉我哪一个包含linkedfactory吗?
PREFIX vocab: <http://linkedfactory.iwu.fraunhofer.de/vocab#>
select * where {
?s vocab:contains <http://localhost:10080/linkedfactory/demofactory> .
}
我该如何处理这种情况?(注:使用 rdflib-python 创建 Sparql 并解析句子,我使用的是 Stanford CoreNLP-Python)
提前致谢,