0

这是ttl文件的一部分。

@prefix rr:    <http://www.w3.org/ns/r2rml#> .
@prefix drugbank: <http://wifo5-04.informatik.uni-mannheim.de/drugbank/resource/drugbank/> .
@prefix ns5:   <http://wifo5-04.informatik.uni-mannheim.de/drugbank/resource/drugs/> .
@prefix ns8:   <http://linkeddata.finki.ukim.mk/lod/data/hifm#> .
@prefix rdf:   <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix virtrdf: <http://www.openlinksw.com/schemas/virtrdf#> .
@prefix xsd:   <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs:  <http://www.w3.org/2000/01/rdf-schema#> .
@prefix hifm-ont: <http://purl.org/net/hifm/ontology#> .

<http://purl.org/net/hifm/data#976423>
        a                         hifm-ont:Drug , drugbank:drugs ;
        rdfs:label                "Amlodipine" ;
        rdfs:seeAlso              ns5:DB00381 ;
        hifm-ont:dosageForm       "Таблети" ;
        hifm-ont:id               976423 ;
        hifm-ont:manufacturer     "REPLEKFARM" ;
        hifm-ont:packaging        20 ;
        hifm-ont:refPriceNoVAT    18.1 ;
        hifm-ont:refPriceWithVAT  19.0 ;
        hifm-ont:similarTo        <http://purl.org/net/hifm/data#989088> , <http://purl.org/net/hifm/data#989096> , <http://purl.org/net/hifm/data#983756> , <http://purl.org/net/hifm/data#989118> , <http://purl.org/net/hifm/data#973424> , <http://purl.org/net/hifm/data#967483> , <http://purl.org/net/hifm/data#985759> , <http://purl.org/net/hifm/data#976385> , <http://purl.org/net/hifm/data#983691> , <http://purl.org/net/hifm/data#973432> , <http://purl.org/net/hifm/data#962392> , <http://purl.org/net/hifm/data#989061> , <http://purl.org/net/hifm/data#983721> , <http://purl.org/net/hifm/data#983713> , <http://purl.org/net/hifm/data#976393> , <http://purl.org/net/hifm/data#985732> , <http://purl.org/net/hifm/data#962384> ;
        hifm-ont:strength         "5 mg" ;
        drugbank:atcCode          "C08CA01" ;
        drugbank:brandName        "AMLODIPIN табл.20 x 5mg" ;
        drugbank:genericName      "Amlodipine" .

<http://purl.org/net/hifm/data#994995>
        a                         drugbank:drugs , hifm-ont:Drug ;
        rdfs:label                "Paroxetine" ;
        rdfs:seeAlso              ns5:DB00715 ;
        hifm-ont:dosageForm       "Таблети/Филм обложени таблети" ;
        hifm-ont:id               994995 ;
        hifm-ont:manufacturer     "PharmaS" ;
        hifm-ont:packaging        30 ;
        hifm-ont:refPriceNoVAT    443.81 ;
        hifm-ont:refPriceWithVAT  466.0 ;
        hifm-ont:similarTo        <http://purl.org/net/hifm/data#989401> , <http://purl.org/net/hifm/data#989266> , <http://purl.org/net/hifm/data#984639> , <http://purl.org/net/hifm/data#994987> , <http://purl.org/net/hifm/data#993603> , <http://purl.org/net/hifm/data#976938> , <http://purl.org/net/hifm/data#978124> , <http://purl.org/net/hifm/data#993581> , <http://purl.org/net/hifm/data#976911> , <http://purl.org/net/hifm/data#989274> ;
        hifm-ont:strength         "30 mg" ;
        drugbank:atcCode          "N06AB05" ;
        drugbank:brandName        "PAROKSETIN PharmaS филм обл.табл. 30 x 30mg" ;
        drugbank:genericName      "Paroxetine" .

我需要获得brandName每种药物的属性。

首先我阅读了文件:

Model model = ModelFactory.createDefaultModel();
InputStream in = FileManager.get().open(inputFile);
model.read(in, "", "TTL");

然后我用语句形成迭代器:

StmtIterator iter = model.listStatements();

接着:

while(iter.hasNext()){
            iter.nextStatement().getProperty(DRUGBANK.brandName));
        }

所以我收到一条错误消息,提示找不到符号 DRUGBANK。如何获取并打印该brandName属性?

4

0 回答 0