2010-06-13 14 views
1

我已經使用Protege 4.1 alpha創建了RDF/OWL文件。 我還在Protege中創建了一個名爲CheapPhone的已定義類。該類別具有以下所示的限制:推斷具有整數基數約束的實例的問題

(hasPrice some integer[< 350]) 

每當手機的價格低於350時,便推斷爲CheapPhone。 在Protege 4.1 alpha中推斷此問題沒有任何問題。但是,我無法用耶拿推斷這一點。

我還創建了一個名爲SmartPhone的定義類。這個類別還有一個限制,如下所示:

(has3G value true) and (hasInternet value true) 

每當手機有3G和互聯網,它被推斷爲智能手機。 在這種情況下,在Protege和Jena中推斷這一點都沒有問題。

我開始認爲Jena的默認推理引擎存在問題。 我在Java中使用的代碼如下:

Reasoner reasoner = ReasonerRegistry.getOWLReasoner(); 

reasoner = reasoner.bindSchema(ontModel); 
    OntModelSpec ontModelSpec = OntModelSpec.OWL_MEM_MINI_RULE_INF; 
    ontModelSpec.setReasoner(reasoner); 
    // Create ontology model with reasoner support 
      // ontModel was created and read before, so I don't share the code in order 
      // not to create garbage here 
    OntModel model = ModelFactory.createOntologyModel(ontModelSpec, ontModel); 

    OntClass sPhone = model.getOntClass(ns + "SmartPhone"); 
    ExtendedIterator s = sPhone.listInstances(); 
    while(s.hasNext()) { 
     OntResource mp = (OntResource)s.next(); 
     System.out.println(mp.getURI()); 
    } 

此代碼工作完美,並返回我的情況,但是當我改變下面的代碼,使之適合CheapPhone,它不返回任何東西。

OntClass sPhone = model.getOntClass(ns + "CheapPhone"); 

我做錯了什麼?

回答

1

數據範圍([< 350]位)是OWL 2的一項功能.Jena不支持OWL 2.請參閱W3C的OWL 2 Implementations頁面以獲取支持OWL 2的工具列表 - 您必須使用其中的一個。 (耶拿的一些實驗性工作已經在那裏上市,但這絕對沒有成爲耶拿的一個版本。)