我有一个块SKOS文件,我正试图用它来读取xml.dom.minidom. 下面是一个示例条目:
<rdf:Description rdf:about="http://...">
<rdf:type rdf:resource="http://www.w3.org/2004/02/skos/core#Concept"/>
<skos:narrowMatch rdf:resource="http://dbpedia.org/resource/Biology"/>
<skos:narrowMatch rdf:resource="http://rdf.freebase.com/ns/m.01540"/>
<skos:prefLabel xml:lang="en">Biology and Biochemistry</skos:prefLabel>
<skos:scopeNote xml:lang="en">Used for all coverage of biology and biochemistry unless a more narrow term applies.</skos:scopeNote>
</rdf:Description>
我可以访问所有skos:预标签有点像。。。在
^{pr2}$但我要的是skos:范围注释也是。我是不是用错了工具?在
我不知道更好的方法,但我会做以下事情:
代码如下:
讨论
getElementsByTagName()
返回一个列表,而且我确信在父节点下有一个同名的节点,所以我继续并获取第一个节点(索引[0]
)element.nextSibbling
,但它将新行作为“node”返回。我可以一直查询下一个兄弟姐妹,直到找到我要查找的内容,但这需要大量代码。此外,无法保证scopeNote将跟随prelabel,因此更安全的做法是转到父级进行搜索。在你可以试试这个
相关问题 更多 >
编程相关推荐