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

如何指定属性的“任何”值?

  •  0
  • ScalaBoy  · 技术社区  · 6 年前

    enter image description here

    这意味着“CategoryHierarchy”类的所有个体都必须指定“hasOpeningTime”属性。 存在以下关系:

    CategoryHierarchy -> hasOpeningTime > Season
    

    “季节”类有以下子类:

    spring
    summer
    autumn
    winter
    

    但是,有许多类别可以分配给任何季节。例如,属于“电影鉴赏家”类别的个人应该有任何季节。

    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
    PREFIX owl: <http://test.com/my-ontology.owl#> 
    
    INSERT { 
      owl:act_1 rdf:type owl: CinemasTheatres . 
      owl:act_1 owl:hasOpeningTime owl:* .       // ???
    } 
    WHERE {
      FILTER NOT EXISTS { 
        owl:act_1 rdf:type owl: CinemasTheatres . 
      } 
    } 
    

    更新:

    CinemasTheatres 将是:

    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
    PREFIX owl: <http://test.com/my-ontology.owl#> 
    
    INSERT DATA { 
      owl:act_1 rdf:type owl: CinemasTheatres . 
      owl:act_1 owl:hasOpeningTime owl:spring .
      owl:act_1 owl:hasOpeningTime owl:summer .
      owl:act_1 owl:hasOpeningTime owl:autumn .
      owl:act_1 owl:hasOpeningTime owl:winter .
    }  
    
    1 回复  |  直到 6 年前
        1
  •  0
  •   ScalaBoy    6 年前

    在阅读了AKSW的评论之后,解决方案添加了多个季节的实例 CinemasTheatres 具体如下:

    PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> 
    PREFIX test: <http://test.com/my-ontology.owl#> 
    
    INSERT DATA { 
      test:act_1 rdf:type test: CinemasTheatres . 
      test:act_1 test:hasOpeningTime test:spring .
      test:act_1 test:hasOpeningTime test:summer .
      test:act_1 test:hasOpeningTime test:autumn .
      test:act_1 test:hasOpeningTime test:winter .
    }