当前位置: 首页 > 知识库问答 >
问题:

owl api state ObjectProperty imports中个人之间的关系

呼延英奕
2023-03-14

我有一个导入其他本体实例的本体实例,并且我试图使用ObjectProperty声明导入个体(Professors-instanceacm-ccs-lite-core)与主本体实例(corsures-instance)的个体之间的关系。

<!-- http://www.semanticweb.org/lsarni/ontologies/professors-instance#Andrés_Calviño -->

<rdf:Description rdf:about="http://www.semanticweb.org/lsarni/ontologies/professors-instance#Andrés_Calviño">
    <curricula:inChargeOf rdf:resource="http://www.semanticweb.org/lsarni/ontologies/curricula-instance#Software_Architecture"/>
</rdf:Description>

<!-- http://www.semanticweb.org/lulas/ontologies/2018/acm-ccs-lite-core#10011119 -->

<rdf:Description rdf:about="http://www.semanticweb.org/lulas/ontologies/2018/acm-ccs-lite-core#10011119">
    <curricula:taughtIn rdf:resource="http://www.semanticweb.org/lsarni/ontologies/curricula-instance#Databases_1"/>
</rdf:Description>
<!-- http://www.semanticweb.org/lsarni/ontologies/professors-instance#Andrés_Calviño -->

<owl:NamedIndividual rdf:about="http://www.semanticweb.org/lsarni/ontologies/professors-instance#Andrés_Calviño">
    <curricula:inChargeOf rdf:resource="http://www.semanticweb.org/lsarni/ontologies/curricula-instance#Software_Architecture"/>
</owl:NamedIndividual>
File file = new File("C:\\Users\\lulas\\Documents\\Curricula Ontology\\curricula-instance.owl");
OWLOntology o = man.loadOntologyFromOntologyDocument(file);
OWLDataFactory df = o.getOWLOntologyManager().getOWLDataFactory();

IRI curriculaIOR = IRI.create("http://www.semanticweb.org/lsarni/ontologies/curricula");
IRI instanceIOR = IRI.create("http://www.semanticweb.org/lsarni/ontologies/curricula-instance");
IRI profInstanceIOR = IRI.create("http://www.semanticweb.org/lsarni/ontologies/professors-instance");

OWLObjectProperty charge = df.getOWLObjectProperty(curriculaIOR + "#inChargeOf");
OWLIndividual individual = df.getOWLNamedIndividual(profInstanceIOR + "#Andrés_Calviño");
OWLIndividual course = df.getOWLNamedIndividual(instanceIOR + "#Software_Architecture");

OWLObjectPropertyAssertionAxiom objAssertion = df.getOWLObjectPropertyAssertionAxiom(charge, individual, course);
AddAxiom addAxiom = new AddAxiom(o, objAssertion);
man.applyChange(addAxiom);

正如你们两个都说代码是正确的,我对一个导入的本体使用了不正确的IRI,这就是为什么它会充当这个NamedIdiversitys的不同之处。

共有1个答案

巩阳秋
2023-03-14

带有rdf:about`IRI的rdf:description相当于一个命名的个体,因此这两个版本之间没有真正的区别。它们将被OWL API解析为相同的东西。

不确定Protege为什么要以这种格式输出它--正如Henriette在评论中所问的,是哪个版本的Protege在这样做?

 类似资料:
  • 感谢(在Spring中使用@Valid vs@Validated)以及在Spring中使用@Valid和@Validated之间的差异。我现在明白他们之间的区别了。 然而,我无法理解特定的场景。 我在控制器endpoint中接收到一个整数,我想使用JSR-303进行验证(我只会使用最小值(1)),以确保得到一个整数 困惑-在我将放在控制器类上,尝试后,设置才起作用,但没有起作用。只是想弄明白为什么

  • 我正在寻找一种方法来声明“2个依赖项之间的依赖项”。 例如,在我的模块中,我ivy.xml以下行: 我的问题是,日志经典 1.0.13 依赖于 slf4j-api 1.7.5,而我的模块依赖于 1.6.6(slf4japiversion 的值)。 我无法更改 slf4japiversion,但将来它可以由其他人升级。 有没有办法声明对logback的依赖关系,以检索与我的slf4j api版本兼容

  • 我正在开发一个Grails应用程序。我创建了3个实体客户,产品和订单。客户可以有许多订单,但每个订单只能包含单一产品。因此,单个订单可以关联到一个客户和一个产品。以下是我的域名: 顾客: 订单: 产品: 我使用generate all生成了控制器、视图,运行应用程序时出现以下错误: 我也不能创造一个客户。域映射有什么问题吗? 我的数据源配置如下:

  • 我是JPA的新手,我正试图让我的实体类正常工作,但我的代码总是给我返回这样的错误:“字段[produtos.marca_idmarca]存在多个可写映射” 这些是我的实体类: 我试图在produtos和Marca之间建立一个单向的多对一的关系(1个Marca对许多produtos): 错误: 如果不存在则创建表。(INT NOT NULL AUTO_INCREMENT,INT(13)NOT NUL

  • 我的Spring Boot应用程序中有两个实体: 使用者JAVA 和 Role.java 我的MySql数据库 我已经排除了这个问题的getter和setter方法。 我想实现两个实体之间的多对多关系。每个用户都应该能够为自己分配多个角色 我已经在我的数据库中为这两个表创建了一个映射表。它有几排 用户id 我还创建了一个新的实体UserRole。java,如下所示: 现在我的问题是:这种构造正确吗

  • 我正在将应用程序从一个服务器迁移到另一个服务器。根据这个应用程序的连接字符串,它正在接触不同的数据库。这意味着DB1中的视图查询将触及DB2中的表。因此,在迁移这个应用程序时,我经常看到“数据库不可用”的错误链,每次我看到这样的错误,我必须迁移特定的数据库。 我想知道,既然我们有ER图来了解数据库中表之间的关系,那么在SQL server中是否有任何方法来了解服务器中不同数据库之间的关系/链接?有