2013-07-25 52 views
1

我有兩個圖形命名爲<http://localhost:5822/fub> & <http://localhost:5822/fub_byrn>。 這兩個圖都包含MetaphoneCode。 我想要得到Metaphone的結果,它們在Graph中都有相同的MetaphoneCode。 我執行這個查詢後,我沒有geting結果。 需要幫助和建議。SPARQL QUERY什麼也沒有提供

SELECT ?MetaPhone 
WHERE 
{ 
    GRAPH <http://localhost:5822/fub> 
    { 
    GRAPH ?g {} 
    { ?s <http://localhost:2020/vocab/dbo_UniData_MetaPhoneCode> ?MetaPhone . } 
    } 
    GRAPH <http://localhost:5822/fub_byrn> 
    { 
    GRAPH ?g {} 
    { ?s <http://localhost:2020/vocab/dbo_FUB_Bayern_MetaPhoneCode> ?MetaPhone . } 
    } 
} 
LIMIT 100 
+0

如果沒有看到一些數據,很難回答這個問題。你可以運行一個限制性較小的查詢(例如,從這兩個圖中選擇一些三元組),以便我們可以看到每個圖中的內容? –

+0

重複在http://answers.semanticweb.com/questions/23825/sparql-two-graph-match – RobV

回答

0

當一個更可讀的方式格式化的,你的查詢是:

select ?MetaPhone where { 
    Graph <http://localhost:5822/fub> { 
    Graph ?g { 
    } 
    { 
     ?s <http://localhost:2020/vocab/dbo_UniData_MetaPhoneCode> ?MetaPhone; 
    } 
    } 

    Graph <http://localhost:5822/fub_byrn> { 
    Graph ?g { 
    } 
    { 
     ?s <http://localhost:2020/vocab/dbo_FUB_Bayern_MetaPhoneCode> ?MetaPhone; 
    } 
    } 
} 
LIMIT 100 

至少有兩個問題:

  1. 你的模式graph ?g {}不會做任何事情除了將?g綁定到數據集中的每個圖形。目前還不清楚這會對任何事情產生負面影響,但很難看出它爲什麼會有用。

  2. 您在fub圖表和fub_byrn圖表中使用了MetaPhoneCode的不同屬性。在fub

    <http://localhost:2020/vocab/dbo_UniData_MetaPhoneCode> 
    

    而在fub_byrn

    <http://localhost:2020/vocab/dbo_FUB_Bayern_MetaPhoneCode> 
    

    難道這些應該是一樣的嗎?

+0

其實兩者都有不同的屬性,因爲Bothr的graphe有幾個標題有不同的MetaphoneCode.I想檢查哪個MetaphoneCode是相同的。 –

+0

@asherbaig那麼,如果這些屬性不同,是否有可能手機(有代碼)的URI也不同?也許你應該查詢'?s1 <... UniData_MetaPhoneCode>?代碼'和'?s2 <... Bayern_MetaPhoneCode>?代碼'和'select?s1?s2?code'。然後你會看到所有具有相同代碼的電話對。這是一個限制性較小的查詢,並且可能會有更多結果,因此您很可能會返回_something_。 –

+0

我在這兩個圖上都生成了一些Metaphonecode,我只是想展示它們。可能是你不瞭解我的問題。我不確定。 –