在构建本体时,应该除了定义类以外,还需要实例化这些类。示例代码如下:
Classes = [ "Person", "Animal", "Vehicle", "Food" ]
Person = Classes[0] Animal = Classes[1] Vehicle = Classes[2] Food = Classes[3]
Person_hasName = "has name" Person_hasAge = "has age" Animal_hasSize = "has size" Vehicle_hasColor = "has color" Food_isEdible = "is edible"
Person_hasName_property = { Person_hasName: "string" } Person_hasAge_property = { Person_hasAge: "int" } Animal_hasSize_property = { Animal_hasSize: "int" } Vehicle_hasColor_property = { Vehicle_hasColor: "string" } Food_isEdible_property = { Food_isEdible: "bool" }
is_a = "is a" has = "has"
Person_is_a_Animal = { is_a: Animal } Animal_hasPerson = { has: Person } Vehicle_is_a_Animal = { is_a: Animal } Food_is_a_Animal = { is_a: Animal }
上一篇:本体与句法表示