2015-04-22 15 views
1

隨着Blazegraph以下RDF(從this answer截取):爲什麼貓頭鷹:限制推理在Blazegraph中不起作用?

:eats rdf:type owl:ObjectProperty . 

:Vegetable rdf:type owl:Class ; 
     rdfs:subClassOf owl:Thing . 

:Vegetarian rdf:type owl:Class ; 
     owl:equivalentClass [ rdf:type owl:Restriction ; 
           owl:onProperty :eats ; 
           owl:someValuesFrom :Vegetable 
          ] . 

:Carrot rdf:type :Vegetable , 
      owl:NamedIndividual . 

:John rdf:type owl:NamedIndividual , owl:Thing ; 
     :eats :carrot . 

以下SPARQL正在返回空白:

select ?who 
where 
{ 
    ?who a :Vegetarian .  
} 

下面是Blazegraph命名空間CONFIGS(Blazegraph從命令行運行作爲NanoSparqlServer ):

com.bigdata.namespace.kb.spo.com.bigdata.btree.BTree.branchingFactor 1024 
com.bigdata.relation.container test-ng-2 
com.bigdata.journal.AbstractJournal.bufferMode DiskRW 
com.bigdata.journal.AbstractJournal.file bigdata.jnl 
com.bigdata.journal.AbstractJournal.initialExtent 209715200 
com.bigdata.rdf.store.AbstractTripleStore.vocabularyClass com.bigdata.rdf.vocab.DefaultBigdataVocabulary 
com.bigdata.rdf.store.AbstractTripleStore.textIndex false 
com.bigdata.btree.BTree.branchingFactor 128 
com.bigdata.namespace.kb.lex.com.bigdata.btree.BTree.branchingFactor 400 
com.bigdata.rdf.store.AbstractTripleStore.axiomsClass com.bigdata.rdf.axioms.OwlAxioms 
com.bigdata.service.AbstractTransactionService.minReleaseAge 1 
com.bigdata.rdf.sail.truthMaintenance true 
com.bigdata.journal.AbstractJournal.maximumExtent 209715200 
com.bigdata.rdf.sail.namespace test-ng-2 
com.bigdata.relation.class com.bigdata.rdf.store.LocalTripleStore 
com.bigdata.rdf.store.AbstractTripleStore.quads false 
com.bigdata.relation.namespace test-ng-2 
com.bigdata.btree.writeRetentionQueue.capacity 4000 
com.bigdata.rdf.store.AbstractTripleStore.statementIdentifiers true 

我錯過了什麼?

回答

2

有一些RDF語法問題,但其根本原因是Blazegraph不支持OWL推理。見當前support。對於和ELK Reasoner已經有了一些工作。

關於這個例子中的RDF,這裏是一個經過驗證可以在Blazegraph 1.5.1中加載的更新。它整合了上面的反饋並添加了命名空間。我用上面的屬性創建了一個屬性(test.properties)文件,並使用來自Sourceforge的可執行jar加載Blazegraph。

java -Xmx2g -Dbigdata.propertyFile=test.properties -jar bigdata-bundled.jar

進入工作臺:http://localhost:9999/bigdata/並粘貼下面RDF到工作臺上選擇「RDF數據」的格式以「海龜」中的「更新」選項卡。

@prefix : <http://stackoverflow.com/> . 
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . 
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . 
@prefix owl: <http://www.w3.org/2002/07/owl#> . 

:eats rdf:type owl:ObjectProperty . 

:Vegetable rdf:type owl:Class ; 
    rdfs:subClassOf owl:Thing . 

:Vegetarian rdf:type owl:Class ; 
    owl:equivalentClass [ rdf:type owl:Restriction ; 
          owl:onProperty :eats ; 
          owl:someValuesFrom :Vegetable 
         ] . 

:Carrot rdf:type :Vegetable , 
     owl:NamedIndividual . 

:carrot rdf:type owl:NamedIndividual , owl:Thing, :Carrot . 

:John rdf:type owl:NamedIndividual , owl:Thing ; 
      :eats :carrot . 

如果然後去查詢選項卡,並運行類似:

select * where { ?s ?p ?o } 

你會看到所有由OWLAxiomsVocabulary推斷三元的。

1

的原因似乎是一個事實,即在

:胡蘿蔔RDF:類型:蔬菜,

你從一個大寫字母開始胡蘿蔔,但在

:eats :carrot . 

您使用小寫字母。

+0

但大概胡蘿蔔是一個個體,是胡蘿蔔的一個實例。由於吃是一個對象屬性,所以說「約翰吃胡蘿蔔」是沒有意義的,因爲對象屬性將個體與其他個體相關聯,而不是類。 –

+0

我認爲這裏的胡蘿蔔是一個個體,和胡蘿蔔一樣。不一定是同一個。 – Ignazio

+0

由於胡蘿蔔的完整定義包含rdf:type owl:NamedIndividual,我認爲這只是一個錯字 –

0

這個數據沒有很好形成尚未:

:Carrot rdf:type :Vegetable , 
      owl:NamedIndividual . 

:John rdf:type owl:NamedIndividual , owl:Thing ; 
     :eats :carrot . 

還就需要說:胡蘿蔔類型的單個:胡蘿蔔,與像斷言:

:carrot rdf:type owl:NamedIndividual , owl:Thing, :Carrot . 

然後,因爲:胡蘿蔔將是胡蘿蔔的一個實例:胡蘿蔔是蔬菜的一個子類:你可以推斷:胡蘿蔔是蔬菜的一個例子,因此:約翰:吃一些:蔬菜。如果Blazegraph支持OWL推理(例如,不僅僅是RDFS推理),那應該足以讓你推斷:John是一個素食者(至少根據素食者的這個非標準定義)。