0

skos:Concept で子にアクセスしたい。getChildren("skos:Concept") と getChildren("Concept") の両方で、代わりに何を使用すればよいか空のリストが返されます。

私の例 データ:

<owl:AnnotationProperty rdf:about="&dc;identifier"/>
<owl:ObjectProperty rdf:about="&skos;narrower"/>

<skos:Concept rdf:about="#concept:0_acetylpantolactone:4253501">
    <skos:prefLabel xml:lang=""
        >0-acetylpantolactone</skos:prefLabel>
    <skos:hiddenLabel xml:lang=""
        >2(3H)-Furanone, 3-(acetyloxy)dihydro-4,4-dimethyl-, (R)-</skos:hiddenLabel>
    <dc:identifier rdf:resource="urn:CHID:028227363"/>
    <dc:identifier rdf:resource="urn:MESH:C014305"/>
</skos:Concept>

<skos:Concept rdf:about="#concept:1012S:4202655">
    <skos:prefLabel xml:lang="">1012S</skos:prefLabel>
    <skos:hiddenLabel xml:lang="" >C19-H16-Cl2-N6-O</skos:hiddenLabel>
    <skos:hiddenLabel xml:lang="">Compound 1012S</skos:hiddenLabel>
    <dc:identifier rdf:resource="urn:CAS:95211_91_9"/>
    <dc:identifier rdf:resource="urn:CHID:095211919"/>
</skos:Concept>
4

1 に答える 1

1

getChildren(String) の javadoc によると、「これは、指定されたローカル名を持ち、名前空間に属さない、この要素内に直接 (1 レベルの深さで) ネストされたすべての子要素のリストを返します」。問題は、要素に名前空間があり、getChildren(String, Namespace) を使用する必要があることだと思います。

Namespace ns = Namespace.getNamespace("skos", [String uri]);
List l = elem.getChildren("Concept", ns);
于 2010-03-25T11:59:04.670 に答える