簡體   English   中英

如何創建一個新的owl:DatatypeProperty並使用owl API將其添加到現有的本體中?

[英]How to create a new owl:DatatypeProperty and add it at an exisisting ontology with owl api?

我想要創建一個新的owl:DatatypeProperty,如下所示:

<owl:DatatypeProperty rdf:about="http://sisinflab.poliba.it/semanticweb/ontologies/architecturalpatterns#extensibilityRate">
    <rdf:type rdf:resource="http://www.w3.org/2002/07/owl#FunctionalProperty"/>
    <rdfs:label xml:lang="en">extensibilityRate</rdfs:label>
    <rdfs:range>
        <rdfs:Datatype>
            <owl:intersectionOf rdf:parseType="Collection">
                <rdfs:Datatype>
                    <owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
                    <owl:withRestrictions rdf:parseType="Collection">
                        <rdf:Description>
                            <xsd:minInclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">0</xsd:minInclusive>
                        </rdf:Description>
                    </owl:withRestrictions>
                </rdfs:Datatype>
                <rdfs:Datatype>
                    <owl:onDatatype rdf:resource="http://www.w3.org/2001/XMLSchema#integer"/>
                    <owl:withRestrictions rdf:parseType="Collection">
                        <rdf:Description>
                            <xsd:maxInclusive rdf:datatype="http://www.w3.org/2001/XMLSchema#integer">4</xsd:maxInclusive>
                        </rdf:Description>
                    </owl:withRestrictions>
                </rdfs:Datatype>
            </owl:intersectionOf>
        </rdfs:Datatype>
    </rdfs:range>
</owl:DatatypeProperty>

並將其添加到我的貓頭鷹本體中,但是我做不到。 有什么建議么?

我正在嘗試遵循此處的示例(第235行); Eclipse不會顯示編譯或運行錯誤,但是不會更新本體。

您指向的測試方法具有以下內容:

manager.saveOntology(ontology, new StreamDocumentTarget(new ByteArrayOutputStream()));

在這里,本體被寫入保存在內存中的字節數組,因此不會有任何更改保存到文件中。 對於要修改的原始文件,您需要刪除第二個參數,然后使用

manager.saveOntology(ontology);

如果本體是通過代碼創建的,並且從未保存過,則必須傳遞一個實際的文件輸出流(這樣才能創建和填充文件。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM