在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>发布于 2009-07-14 21:02:55
这个问题非常不清楚,所以您得到了一个通用的答案:)每个OWL属性必须是数据类型或对象类型。
在定义本体时,并不要求您将数据类型属性限制为特定的文字类型。你可以保持它的泛型,接受任何类型的文字。ROWLEX确实支持这一点。有一个通用的RdfLiteral类和一系列特定的文字类,如RdfLiteralString,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如果您的本体中的DateOfBirth数据类型属性不限于DateTime,那么上面的所有行都不会出现错误。然而,我个人的观点是,如果你能更具体,就更具体,因为你可以防止错误和误解。
https://stackoverflow.com/questions/1127370
复制相似问题