在Rowlex中,是否可以删除每个属性的“ RDF:DATATYPE”属性和/或使用常见的RDF模式?

例子:

<MyOntology:Channel>
   <MyOntology:title rdf:datatype="http://www.w3.org/2001/XMLSchema#string">My news</MyOntology:title>
   <MyOntology:description rdf:datatype="http://www.w3.org/2001/XMLSchema#string">My desc</MyOntology:description>
</MyOntology:Channel>
有帮助吗?

解决方案

这个问题还不清楚,因此您会得到一个通用的答案:)每个猫头鹰属性都必须是数据类型或对象类型。

  • 对象类型属性连接图的两个节点,即不仅主题,而且三重对象也是uri(或空白节点)。
  • 数据类型属性:三重对象是一个可以是字符串,整数,日期时间等的具体值。这些混凝土值称为“文字” -s。文字的基本类型是“文字”,从这些文字类型(字符串,整数,dateTime ...)子分类。

当您定义本体论时,您并不需要将数据类型属性限制为特定的文字类型。您可能会保持通用,接受任何类型的文字。 Rowlex确实支持这一点。有一个通用的rdfleral类和许多特定的文字类,例如rdfliteralsstring,rdfliteraldateTime等。每个特定的文字类都包含明确的和隐性的铸造实现,以将.NET类型转换为文字和背部。因此,在Rowlex中,您可以写下:

    RdfDocument rdfDoc = new RdfDocument();
    // Assuming that Person class and DateOfBirth data type property 
    // are autogenerated from your person-ontology, AND
    // your DateOfBirth data type property is restricted to DateTime
    Person p = new Person("joe", rdfDoc); 
    // Implicit casting from DateTime to RdfLiteralDateTime
    p.DateOfBirth = new Sytem.DateTime(1946, 12, 31); // Compiles OK
    p.DateOfBirth = 26; // Compiler error
    p.DateOfBirth = "Hello World"; // Compiler error

如果您的本体学中的dateofth数据类型属性不限于DateTime,则以上所有行编译的所有行都没有错误。但是,我个人的看法是,如果您可以更具体,请更具体,因为您可以防止错误和沟通不畅。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top