![](/img/trans.png)
[英]How to create relations in owlready2 after the dynamic creation of the property?
使用 owlready2 我可以為我的本體創建屬性,如下所示: 我可以使用 list(onto.properties()) 查看它們。 現在我想使用下面的代碼創建關系(在我的實際代碼中這將動態完成): 但我得到錯誤: 我還嘗試僅使用 ObjectProperty 而不使用 FunctionalPr ...
[英]How to create relations in owlready2 after the dynamic creation of the property?
使用 owlready2 我可以為我的本體創建屬性,如下所示: 我可以使用 list(onto.properties()) 查看它們。 現在我想使用下面的代碼創建關系(在我的實際代碼中這將動態完成): 但我得到錯誤: 我還嘗試僅使用 ObjectProperty 而不使用 FunctionalPr ...
[英]merge two ontologies using owlready
這個賞金已經結束了。 此問題的答案有資格獲得+100聲望賞金。 賞金寬限期在1 小時后結束。 xavi正在尋找一個規范的答案。 我使用owlready2庫制作了2 ontologies 我想merge它們,但我找不到olwready2的方法。 文檔中沒有任何內容。 我只想要一個簡單的字符串匹配並 ...
[英]Add new Individuals to an existing ontology from a dataframe using owlready 2
賞金將在 5 天后到期。 此問題的答案有資格獲得+150聲望賞金。 xavi正在尋找一個規范的答案。 我有以下dataframe corpus column的元素是稱為ontology的onto Class的Individuals 我想將queries column的元素作為individua ...
[英]Create ontology object relations from a dataframe
我有以下dataframe : 從上面的dataframe我使用owlready2創建了一個本體 現在我有以下dataframe Head和Tail包含在上述本體中建模的individuals 如何使用 Type 列創建它們的關系(對象關系)? ...
[英]python OWLReady2 ontology cannot execute the code getting access denied error
我正在嘗試執行文檔https://owlready2.readthedocs.io/en/latest/reasoning.html中提到的本體代碼。 我還提到了推理部分的 Java 路徑,但我仍然收到訪問被拒絕的錯誤。 因為我是這個領域的初學者,請你幫我看看我哪里出錯了。 代碼: [錯誤圖片]( ...
[英]AttributeError: 'NoneType' object has no attribute 'storid'
我對本體非常陌生,尤其是 owlready2。 我在 python 上加載了一個 Ontology 的基本示例 Pizza 並成功導入(我檢查了我是否可以看到我可以看到的類......) 比起我使用以下代碼專門使用 search() 方法搜索一個 class:from owlready2 impo ...
[英]Adding individuals in owlready for imported ontology and storing individuals
我在 Protege 中創建了我的本體。 我已使用 owlready package 將其導入 Python。 如何將此添加的個人存儲到文件中? 我正在使用不同的 function 處理 python 中的這些單個值。 提前致謝。 ...
[英]Finding individuals of a class with a specific restriction
編輯:下面的解決方案我的問題是:我想找到一個 class 的個人,它對某個其他 class 具有一定的 object 屬性限制。 在owlready2中,我可以搜索所有類的所有INDIRECT_is_a並以這種方式過濾。 但是,這在我看來執行不力,因為我必須創建和搜索所有類的所有祖先樹,而不是通過h ...
[英]Loading an ontology from string in Python
我們有一個 Pyspark 對 RDD, .owl文件的路徑作為鍵存儲,文件內容作為值存儲。 我希望使用 Owlready2 進行推理。 要從 OWL 文件加載本體,使用get_ontology()函數。 但是,給定的函數需要文件的 IRI(一種 URL),而我在 Python 中將文件內容作為s ...
[英]Creating Owlready2 properties dynamically
我需要動態創建本體。 對於我正在使用以下方法創建它們的類。 但是對於創建屬性(對象/數據等),我無法找到動態創建它們的方法。 現在我能做的是: 其中“has_grouping”是屬性名稱。 我希望能夠創建可以從變量中導出屬性名稱的屬性。 ...
[英]How can I implement a list of subclass from a class in python's owlready2?
我想在一個基於 protege 的本體中獲取每個類的所有子類,並使用 owlready2 導入到 python 中。 如何為這個本體的集合類創建所有子類的列表? ...
[英]Owlready: subclasses of Thing in worlds different from default_world?
我有以下代碼(最小示例): 導致[onto0.Animal] 。 換句話說,新世界w1中定義的 class 不被識別為Thing的子類,盡管被定義為這樣。 → 那么,如何獲得非默認世界中定義的子類? ...
[英]OWL reasoning from command line with minimal dependencies
我有一個 rdf/xml 語法的 OWL 文件,其中包含一個斷言的本體。 我想應用 OWL DL 推理器來推導其他公理。 我知道我可以在 protegé 中打開文件並在那里應用推理器。 但是我尋找命令行解決方案,因為我想在腳本中自動執行該過程。 我知道owlready2帶有 reasoners Pe ...
[英]Explanations in Consistent OWL Ontologies
我想以編程方式在一致的本體中獲得對推斷公理的解釋,就像在 Protégé UI 中可以做的那樣。 我找不到任何直接的方法。 我找到了owlexplanation repo ,但我無法終生解決依賴問題來設置owlexplanation環境。 我還瀏覽了 owlapi 的javadoc關於解釋(完全避免 ...
[英]How to define multiple domains in owlready2?
我是owlread2的新手。 我想實現這樣的關系 到目前為止,我是這樣嘗試的: 和 但這兩種方法似乎都不起作用。 如果有人能告訴我如何完成這項工作,我會很高興 ...
[英]How to use .instances() method to iterate through all Instances of owl:Thing in owlready2?
我可以使用以下工作正常的代碼遍歷 owlready2 中一個類的所有實例: 但我需要遍歷本體的所有實例(通過 owl:Thing)。 我嘗試了以下但它不起作用: ...
[英]How to return render_template in Flask?
以下代碼從 .py 文件中完美運行,但我想將 HTML 分開並將其放在 templates/index.html 中。 我想我必須在 Flask 中使用 render_template 函數才能返回相同的結果。 我創建了一個文件夾模板和一個文件 index.html。 我使用了 return ...
[英]Unable to import owlready2 modules: Got 'sqlite3.OperationalError: no such table: sqlite_schema' error with ' from owlready2 import * '
from owlready2 import *運行此行時出現以下錯誤 python 版本 3.8.3 有什么解決辦法嗎? 先感謝您 ...
[英]owlready2 reasoner does not generate inferred object property assertions with a SWRL rule
假設一個 OWL 本體包含以下 SWRL 規則: 並遵循 object 屬性斷言: 當我在 Protege 中運行 Hermit 推理器時,我得到以下推斷的 object 屬性斷言: 但是,當我使用 owlready2 加載相同的本體並運行其 Hermit 推理器時,我沒有得到任何推斷的 objec ...
[英]Creating an instance in OWLready2 creates a completely new class instead of asigning it to the existing class
我正在嘗試按照官方網站上的教程創建一個簡單的本體。 代碼運行順利,運行此代碼時一切似乎都很好: 問題:當我在 Protégé 中打開生成的文件“test”時,我的實例“drug1”不是先前定義的 class Drug 的一部分,而是同名Drug的新 class 的一部分(我總是用斜體表示這個,所以 ...