2013-08-04 56 views
0

我使用SPARQL獲得使用java.below從RDF文件相關的標記信息我SPARQL查詢嘗試讀取標籤的相關信息,從RDF file.but它是特定的標記相關信息沒有得到結果。 我RDF文件包含以下信息:如何從Java中使用SPARQL RDF文件

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:c="http://s.opencalais.com/1/pred/"> 
    <rdf:Description c:calaisRequestID="e35f8204-619c-e1cd-1403-db29b8d53276" c:id="http://id.opencalais.com/yrGQcSODPQmkcclcdKOwNg" rdf:about="http://d.opencalais.com/dochash-1/6ee25504-ff98-34e4-af60-dde69f5ddf73"><rdf:type rdf:resource="http://s.opencalais.com/1/type/sys/DocInfo"/> 
    <c:document></c:document> 
    </rdf:Description> 
    <rdf:Description rdf:about="http://d.opencalais.com/dochash-1/6ee25504-ff98-34e4-af60-dde69f5ddf73/SocialTag/1"> 
    <rdf:type rdf:resource="http://s.opencalais.com/1/type/tag/SocialTag"/> 
    <c:docId rdf:resource="http://d.opencalais.com/dochash-1/6ee25504-ff98-34e4-af60-dde69f5ddf73"/> 
    <c:socialtag rdf:resource="http://d.opencalais.com/genericHasher-1/4f9a3d55-33f5-3738-a2f7-3e9065a5a169"/> 
    <c:name>Computing</c:name><c:importance>1</c:importance><c:originalValue>Computing</c:originalValue> 
    </rdf:Description> 

我SPARQL查詢:

prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
    prefix ctag: <http://s.opencalais.com/1/type/tag/SocialTag> 
    prefix c: <http://s.opencalais.com/1/pred/> 
    construct { 
     ?tag c:name ?name ; 
      c:importance ?importance . 
    } 
    where { 
     ?tag a ctag:SocialTag ; 
      c:name ?name ; 
      c:importance ?importance . 
    } 

,但我沒有得到結果如何做到這一點請建議我。

+0

這似乎是一個有關的問題[答案](http://stackoverflow.com/a/18017317/1281433)我給你前面的問題,[如何從RDF文件使用Java獲取特定標籤相關資料] (http://stackoverflow.com/questions/18014074/how-to-get-specific-tag-related-information-from-rdf-file-using-java),你說的工作(但還沒有接受) 。正如@AndyS在回答中指出的那樣,您只是簡單地從我的答案中錯誤地複製了SPARQL查詢。 –

回答