Protege-OWL:Class必须具有每个<value>中的一个

eXi*_*nCe 7 owl manchester-syntax protege conditional-statements

我是新手,我必须使用曼彻斯特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
Run Code Online (Sandbox Code Playgroud)

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

eXi*_*nCe 1

我通过改变方法,为这个项目和这个问题提出了一个具体的解决方案。单元格不是具有值的类,而是可以通过认为值可以是需要放入单元格中的实体来轻松完成。

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

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