【问题标题】:Protege-OWL: Class must have one of each <value>Protege-OWL:类必须具有每个 <value> 之一
【发布时间】:2017-05-16 14:53:53
【问题描述】:

我是 protege 新手,我必须使用曼彻斯特 OWL 语法为具有与 soduku 相似属性的网格建模。

我一直在寻找,但我似乎无法找到一种方法来制定一个公理,即“每列必须有 4 个单元格,并且必须具有这些值中的每一个”。 如,假设一个 4x1 列,每个单元格必须包含一个数字,并且该列必须包含所有数字 [1:4]。

我已经设置了一些对象、数据属性和对象属性,我将在这里留下。我将把完整的 .owl 文件留在这里,以便加载它,从而更容易提供帮助。

非常感谢所有帮助。

Prefix: dc: <http://purl.org/dc/elements/1.1/>
Prefix: owl: <http://www.w3.org/2002/07/owl#>
Prefix: rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
Prefix: rdfs: <http://www.w3.org/2000/01/rdf-schema#>
Prefix: GridTest: <http://www.semanticweb.org/existance/ontologies/2017/4/GridTest#>
Prefix: xml: <http://www.w3.org/XML/1998/namespace>
Prefix: xsd: <http://www.w3.org/2001/XMLSchema#>



Ontology: <http://www.semanticweb.org/existance/ontologies/2017/4/GridTest>


Datatype: xsd:int


Datatype: xsd:integer


ObjectProperty: GridTest:hasCell

    SubPropertyOf: 
        GridTest:hasRelation

    Domain: 
        GridTest:Grid

    InverseOf: 
        GridTest:isCellOf


ObjectProperty: GridTest:hasColum

    SubPropertyOf: 
        GridTest:hasRelation

    Domain: 
        GridTest:Grid

    Range: 
        GridTest:Grid

    InverseOf: 
        GridTest:isColumOf


ObjectProperty: GridTest:hasRelation


ObjectProperty: GridTest:isCellOf

    InverseOf: 
        GridTest:hasCell


ObjectProperty: GridTest:isColumOf

    InverseOf: 
        GridTest:hasColum


DataProperty: GridTest:hasValue

    Characteristics: 
        Functional

    Domain: 
        GridTest:Cell

    Range: 
        {"1"^^xsd:int , "2"^^xsd:int , "3"^^xsd:int , "4"^^xsd:int}


Class: GridTest:Cell

    SubClassOf: 
        GridTest:Grid,
        GridTest:hasValue exactly 1 xsd:int


Class: GridTest:Colum

    SubClassOf: 
        GridTest:Grid,
        GridTest:hasCell exactly 4 GridTest:Cell


Class: GridTest:Grid

    SubClassOf: 
        GridTest:hasColum exactly 4 GridTest:Colum


Individual: GridTest:cell1

    Facts:  
     GridTest:isCellOf  GridTest:col,
     GridTest:hasValue  1


Individual: GridTest:cell2

    Facts:  
     GridTest:isCellOf  GridTest:col


Individual: GridTest:cell3

    Facts:  
     GridTest:isCellOf  GridTest:col


Individual: GridTest:cell4

    Facts:  
     GridTest:isCellOf  GridTest:col


Individual: GridTest:col

    Facts:  
     GridTest:isColumOf  GridTest:grid


Individual: GridTest:grid

编辑:这一点是当我运行推理器时,某些单元格的值,它将推断其他单元格的值。 e.x: cell1 = 1, cell2 =2, cell3 = 3 => 推理器会推断出cell4的值为4。

【问题讨论】:

  • 为什么不cell1 hasValue 1cell2 hasValue 2cell3 hasValue 4cell4 hasValue 8?只需让所有人都不同(Edit > Make all individual different),然后推理器会推断出col hasCell cell1col hasCell cell2col hasCell cell3col hasCell cell4
  • 使所有个体不同仅适用于具有单列/行的场景,假设我有两列,将有 2x1、2x2、2x3、2x4。此外,即使你指出推理器的结果非常有用,它不是我假装的,我想做的是例如:cell1 hasValue 1 , cell2 hasValue 2, cell3 hasValue 3,然后当我打开推理器时,它会推断出,因为该列有 4 个单元格,并且由于它必须具有从 1 到 4 的值,因此 cell4 hasValue 4。抱歉回复太长了。
  • 我认为这是不可能的。使用数据属性甚至比使用对象属性更难(这比使用类更难)。数据属性可能是功能性的并且可能是键。据我所知,仅此而已。无法创建具有数据属性的属性链。另请参阅this question
  • P.S.可能,在像你这样的情况下,推理者能够推断出你想要什么,但在更一般的情况下,它的计算成本似乎很高。
  • 这应该是可能的,因为它是我们任务的一部分(一个小型​​学术项目),但可能以其他方式完成。我将尝试使用更多对象和对象属性重新制作它,这样推理者就不会拥有推断数据属性。非常感谢您的回答,我会确保检查该问题。

标签: conditional-statements owl protege manchester-syntax


【解决方案1】:

我已经通过改变方法为这个项目和这个问题提出了一个解决方案。与其将 Cell 视为具有 Value 的类,不如将 Value 视为需要放入 Cell 中的实体来轻松完成。

使用这种思路,一切都可以归结为轴子中的逻辑表达式。

通过拥有一个 Value 类,一个向个体添加值的数据属性,以及用断言的正确 Data 属性表示该值的个体,可以简单地说,Cell 对象(hasvalue value 1) or (hasValue value 2) ...hasvalue exactly 1 value

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-04-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多