代码之家  ›  专栏  ›  技术社区  ›  Siegmeyer

如何在OWL中重用列表?

  •  1
  • Siegmeyer  · 技术社区  · 8 年前

    假设我正在定义一个类 含酒精饮料 :

    :Alcohol rdf:type owl:Class ;
             owl:equivalentClass [ 
                 rdf:type owl:Class ;
                 owl:oneOf ( :Vodka :Champagne :Bourbon :Tequila :Whiskey ) ] .
    

    但我希望各位成员与众不同:

    [ rdf:type owl:AllDifferent ;
      owl:distinctMembers ( :Bourbon :Vodka :Champagne :Whiskey :Tequila ) ] .
    

    我如何在不重复列表的情况下写出这两条语句?

    谢谢

    1 回复  |  直到 8 年前
        1
  •  0
  •   Siegmeyer    8 年前

    如注释中所述,使用空白节点引用:

    :Alcohol a owl:Class ;
        owl:equivalentClass [ a owl:Class ;
                              owl:oneOf _:b0 ] .
    
    [ a owl:AllDifferent ;
      owl:distinctMembers  _:b0 ] .
    
    _:b0 rdf:first :Vodka ;
        rdf:rest ( :Champagne :Bourbon :Tequila :Whiskey ) .
    
    推荐文章