如何在 ontology 中模拟多项选择的可能性?
How to model a multiple choice possibility in a ontology?
我正在使用 protege 5 并尝试将问卷转换为 ontology。而且我无法弄清楚如何为多项选择答案建模。我有一个 class (Class1),它有元素,对于每个元素,一个人可以 select 一个或多个允许的值。例如:
ElementOne :"someStringValue1"、"someStringValue2"、"someStringValue3"、someStringValue4"。
并且用户可以选择 "someStringValue1" 和 "someStringValue2".
关于如何在 protege 和 owl 中建模的任何想法?
您可以使用枚举 类 来模拟一组固定的选择。例如,您可以说
问题 2 答案 ≡ {"choice a", "choice b", "choice c", "none of the above"}
问题 2 ⊑ ∀ hasAnswer.Question2Answers
这是一个 ontology 您可以下载并查看示例。在其中,我宣布了两个问题个人和三个答案个人。我定义了两个属性 hasObjectAnswer 和 hasDataAnswer,因此您可以使用个人或数据类型文字作为答案。我已经说过,问题 1 的可能答案是 answerA、answerB 和 answerC,方法是断言
问题 1 ⊑ ∀ hasObjectAnswer.{answerA, answerB, answerC}
我已经说过问题 2 的可能答案是 "answer one"、"answer two"、"answer three" 和 "none of the above",使用公理:
问题 2 ⊑ ∀ hasDataAnswer.{"answer one", …, "none of the above"}
@prefix : <urn:ex:> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:answerB a owl:Thing , owl:NamedIndividual .
:question2 a owl:Thing , owl:NamedIndividual ;
a [ a owl:Restriction ;
owl:allValuesFrom [ a rdfs:Datatype ;
owl:oneOf ("answer one" "answer two" "answer three" "none of the above")
] ;
owl:onProperty :hasDataAnswer
] .
:answerA a owl:Thing , owl:NamedIndividual .
:question1 a owl:Thing , owl:NamedIndividual ;
a [ a owl:Restriction ;
owl:allValuesFrom [ a owl:Class ;
owl:oneOf ( :answerC :answerB :answerA )
] ;
owl:onProperty :hasObjectAnswer
] .
:hasObjectAnswer a owl:ObjectProperty .
:hasDataAnswer a owl:DatatypeProperty .
:answerC a owl:Thing , owl:NamedIndividual .
我正在使用 protege 5 并尝试将问卷转换为 ontology。而且我无法弄清楚如何为多项选择答案建模。我有一个 class (Class1),它有元素,对于每个元素,一个人可以 select 一个或多个允许的值。例如: ElementOne :"someStringValue1"、"someStringValue2"、"someStringValue3"、someStringValue4"。 并且用户可以选择 "someStringValue1" 和 "someStringValue2".
关于如何在 protege 和 owl 中建模的任何想法?
您可以使用枚举 类 来模拟一组固定的选择。例如,您可以说
问题 2 答案 ≡ {"choice a", "choice b", "choice c", "none of the above"}
问题 2 ⊑ ∀ hasAnswer.Question2Answers
这是一个 ontology 您可以下载并查看示例。在其中,我宣布了两个问题个人和三个答案个人。我定义了两个属性 hasObjectAnswer 和 hasDataAnswer,因此您可以使用个人或数据类型文字作为答案。我已经说过,问题 1 的可能答案是 answerA、answerB 和 answerC,方法是断言
问题 1 ⊑ ∀ hasObjectAnswer.{answerA, answerB, answerC}
我已经说过问题 2 的可能答案是 "answer one"、"answer two"、"answer three" 和 "none of the above",使用公理:
问题 2 ⊑ ∀ hasDataAnswer.{"answer one", …, "none of the above"}
@prefix : <urn:ex:> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
:answerB a owl:Thing , owl:NamedIndividual .
:question2 a owl:Thing , owl:NamedIndividual ;
a [ a owl:Restriction ;
owl:allValuesFrom [ a rdfs:Datatype ;
owl:oneOf ("answer one" "answer two" "answer three" "none of the above")
] ;
owl:onProperty :hasDataAnswer
] .
:answerA a owl:Thing , owl:NamedIndividual .
:question1 a owl:Thing , owl:NamedIndividual ;
a [ a owl:Restriction ;
owl:allValuesFrom [ a owl:Class ;
owl:oneOf ( :answerC :answerB :answerA )
] ;
owl:onProperty :hasObjectAnswer
] .
:hasObjectAnswer a owl:ObjectProperty .
:hasDataAnswer a owl:DatatypeProperty .
:answerC a owl:Thing , owl:NamedIndividual .