From 021eae677c3b57b56977c35d55103adffa4305e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aur=C3=A9lien=20Lamercerie?= <aurelien.lamercerie@laposte.net> Date: Fri, 3 Sep 2021 11:45:36 +0200 Subject: [PATCH] Feature Object (net) and feature relation (system class relation) --- config/config-parameters.ttl | 6 ++ config/semantic-net.ttl | 20 ++++ config/transduction-schemes.ttl | 177 ++++++++++++++++++++++++-------- frame/system-ontology.ttl | 52 +++++++--- 4 files changed, 200 insertions(+), 55 deletions(-) diff --git a/config/config-parameters.ttl b/config/config-parameters.ttl index 4d4f58a5..86cf2010 100644 --- a/config/config-parameters.ttl +++ b/config/config-parameters.ttl @@ -14,6 +14,7 @@ cprm:Config_Parameters rdf:type owl:Class ; cprm:baseURI "https://unsel.tetras-libre.fr/tenet/" ; cprm:netURI "https://unsel.tetras-libre.fr/tenet/semantic-net#" ; + cprm:objectRef "object_" ; . cprm:baseURI rdf:type rdf:Property ; @@ -33,3 +34,8 @@ cprm:netURI rdfs:range xsd:string ; rdfs:subPropertyOf cprm:configParamProperty ; . +cprm:objectRef + rdf:type rdf:Property ; + rdfs:label "Object Reference" ; + rdfs:subPropertyOf cprm:configParamProperty ; +. diff --git a/config/semantic-net.ttl b/config/semantic-net.ttl index 37032b5a..406f574f 100644 --- a/config/semantic-net.ttl +++ b/config/semantic-net.ttl @@ -95,6 +95,16 @@ net:featureClass rdfs:label "feature class" ; rdfs:subPropertyOf net:value ; . +net:has_entity + rdf:type rdf:Property ; + rdfs:label "has entity" ; + rdfs:subPropertyOf net:relation ; +. +net:has_feature + rdf:type rdf:Property ; + rdfs:label "has feature" ; + rdfs:subPropertyOf net:relation ; +. net:listGuiding rdf:type rdf:Property ; rdfs:label "Guiding connector of a list (or, and)" ; @@ -134,10 +144,20 @@ net:objectAttribute rdf:type rdf:Property ; rdfs:label "object attribute" ; . +net:objectType + rdf:type rdf:Property ; + rdfs:label "object type" ; + rdfs:subPropertyOf net:property ; +. net:property rdf:type rdf:Property ; rdfs:label "netProperty" ; . +net:relation + rdf:type rdf:Property ; + rdfs:label "relation" ; + rdfs:subPropertyOf net:property ; +. net:structure rdf:type rdf:Property ; rdfs:label "Linguistic Structure (in UNL Document)" ; diff --git a/config/transduction-schemes.ttl b/config/transduction-schemes.ttl index 766259e7..e396894f 100644 --- a/config/transduction-schemes.ttl +++ b/config/transduction-schemes.ttl @@ -75,6 +75,7 @@ WHERE { # -- old --- BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity2). # -- old --- BIND (concat(?concept3, '_', ?mainEntity) AS ?subEntity3). BIND (concat(?concept23, '_', ?mainEntity) AS ?subEntity23). + # URI (for classes) # -- old --- cprm:Config_Parameters cprm:baseURI ?baseURI. fprm:System_Ontology fprm:frameURI ?frameURI. BIND (concat( ?frameURI, ?entityClass) AS ?s1). @@ -86,11 +87,11 @@ WHERE { BIND (uri(?s3) AS ?subEntity2Uri). BIND (uri(?s4) AS ?subEntity3Uri). BIND (uri(?s5) AS ?subEntity23Uri). - # Label(s) / URI (for instance) + # URI (for instance) BIND (concat(?s1, '_', ?mainInstance) AS ?s6). BIND (uri(?s6) AS ?mainInstanceUri). }""" ; - sh:order "514"^^xsd:decimal ; + sh:order 513.2 ; . cts:add-disjunctive-entity-classes rdf:type sh:SPARQLRule ; @@ -143,6 +144,7 @@ WHERE { # -- old --- BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity2). # -- old --- BIND (concat(?concept3, '_', ?mainEntity) AS ?subEntity3). BIND (concat(?concept23, '_', ?mainEntity) AS ?subEntity23). + # URI (for classes) # -- old --- cprm:Config_Parameters cprm:baseURI ?baseURI. fprm:System_Ontology fprm:frameURI ?frameURI. BIND (concat( ?frameURI, ?entityClass) AS ?s1). @@ -154,11 +156,11 @@ WHERE { BIND (uri(?s3) AS ?subEntity2Uri). BIND (uri(?s4) AS ?subEntity3Uri). BIND (uri(?s5) AS ?subEntity23Uri). - # Label(s) / URI (for instance) + # URI (for instance) BIND (concat(?s1, '_', ?mainInstance) AS ?s6). BIND (uri(?s6) AS ?mainInstanceUri). }""" ; - sh:order "513"^^xsd:decimal ; + sh:order 513.1 ; . cts:add-disjunctive-entity-classes-2--old rdf:type sh:SPARQLRule ; @@ -254,7 +256,7 @@ WHERE { ?net1 net:entityInstance ?mainInstance. # Filter: entity not present in a class list FILTER NOT EXISTS { ?net2 net:class2 ?mainEntity} - # Label(s) / URI (for classes) + # URI (for classes) cprm:Config_Parameters cprm:baseURI ?baseURI. fprm:System_Ontology fprm:frameURI ?frameURI. # -- old --- fprm:System_Entity rdfs:label ?entityLabel. @@ -262,7 +264,7 @@ WHERE { BIND (concat(?s1, '_', ?mainEntity) AS ?s2). BIND (uri( ?s1) AS ?entityUri). BIND (uri(?s2) AS ?mainEntityUri). - # Label(s) / URI (for instance) + # URI (for instance) BIND (concat(?s1, '_', ?mainInstance) AS ?s3). BIND (uri(?s3) AS ?mainInstanceUri). }""" ; @@ -285,25 +287,25 @@ PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#> # -- Add Entity class / instance in System Ontology CONSTRUCT { # Classification - ?mainFeatureUri rdfs:subClassOf ?featureUri. - ?mainFeatureUri rdfs:label ?mainFeature. + ?subFeatureUri rdfs:subClassOf ?featureUri. + ?subFeatureUri rdfs:label ?featureConcept. # Instantiation: no instance for feature } WHERE { - # net1: entity + # net1: feature ?net1 a net:Instance. ?net1 net:type net:feature. ?net1 net:featureClass ?featureClass. - ?net1 net:concept ?mainFeature. + ?net1 net:concept ?featureConcept. # Filter: entity not present in a class list - FILTER NOT EXISTS { ?net2 net:class2 ?mainFeature} - # Label(s) / URI (for classes) + FILTER NOT EXISTS { ?net2 net:class2 ?featureConcept} + # URI: class cprm:Config_Parameters cprm:baseURI ?baseURI. fprm:System_Ontology fprm:frameURI ?frameURI. BIND (concat( ?frameURI, ?featureClass) AS ?s1). - BIND (concat(?s1, '_', ?mainFeature) AS ?s2). + BIND (concat(?s1, '_', ?featureConcept) AS ?s2). BIND (uri( ?s1) AS ?featureUri). - BIND (uri(?s2) AS ?mainFeatureUri). + BIND (uri(?s2) AS ?subFeatureUri). }""" ; sh:order "501"^^xsd:decimal ; . @@ -339,7 +341,7 @@ WHERE { ?net1 net:class2 ?subEntity. ?net1 net:entityInstance ?mainInstance. # Filter -- old --- FILTER NOT EXISTS { ?net2 net:class2 ?mainEntity} - # Label(s) / URI (for classes) + # URI (for classes) # -- old --- BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity). # -- old --- cprm:Config_Parameters cprm:baseURI ?baseURI. fprm:System_Ontology fprm:frameURI ?frameURI. @@ -350,11 +352,11 @@ WHERE { # -- old --- BIND (uri( ?s1) AS ?entityUri). BIND (uri(?s2) AS ?mainEntityUri). BIND (uri(?s3) AS ?subEntityUri). - # Label(s) / URI (for instance) + # URI (for instance) BIND (concat(?s1, '_', ?mainInstance) AS ?s4). BIND (uri(?s4) AS ?mainInstanceUri). }""" ; - sh:order "512"^^xsd:decimal ; + sh:order 512.1 ; . cts:bypass-reification rdf:type sh:SPARQLRule ; @@ -380,6 +382,50 @@ WHERE { } """ ; sh:order "001"^^xsd:decimal ; . +cts:complement-list-of-entity-classes + rdf:type sh:SPARQLRule ; + sh:construct """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 xsd: <http://www.w3.org/2001/XMLSchema#> +PREFIX unl: <https://unl.tetras-libre.fr/rdf/schema#> +PREFIX net: <https://unsel.tetras-libre.fr/tenet/semantic-net#> +PREFIX cprm: <https://unsel.tetras-libre.fr/tenet/config/parameters#> +PREFIX req: <https://unsel.tetras-libre.fr/tenet/frame/requirement-ontology#> +PREFIX sys: <https://unsel.tetras-libre.fr/tenet/frame/system-ontology#> +PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#> + +# -- Complement Entity classes with feature relation +CONSTRUCT { + # Complement with feature relation + ?subEntityUri sys:has_feature ?featureUri. +} +WHERE { + # net1: entity class list + ?net1 a net:Instance. + ?net1 net:type net:entity_class_list. + ?net1 net:entityClass ?entityClass. + ?net1 net:class2 ?subEntity. + ?net1 net:has_feature ?featureObject. + # object: feature + ?featureObject a net:Object. + ?featureObject net:objectType sys:Feature. + ?featureObject net:node ?FeatureUW. + ?featureObject net:featureClass ?featureClass. + ?featureObject net:concept ?featureConcept. + # URI: entity class + fprm:System_Ontology fprm:frameURI ?frameURI. + fprm:System_Entity rdfs:label ?entityLabel. + BIND (concat( ?frameURI, ?entityClass) AS ?c1). + BIND (concat(?c1, '_', ?subEntity) AS ?c2). + BIND (uri(?c2) AS ?subEntityUri). + # URI: feature class + BIND (concat( ?frameURI, ?featureClass) AS ?f1). + BIND (concat(?f1, '_', ?featureConcept) AS ?f2). + BIND (uri(?f2) AS ?featureUri). +}""" ; + sh:order 512.2 ; +. cts:compose-entity-modlist-1 rdf:type sh:SPARQLRule ; sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#> @@ -394,7 +440,19 @@ PREFIX sys: <https://unsel.tetras-libre.fr/tenet/frame/system-ontology#> PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#> # -- Compose an Entity net and a Complement ModList net -CONSTRUCT { +CONSTRUCT { + # Net Object: feature + ?newFeature2 a net:Object. + ?newFeature2 net:objectType sys:Feature. + ?newFeature2 net:node ?uw2. + ?newFeature2 net:featureClass ?featureClass. + ?newFeature2 net:concept ?concept2. + ?newFeature3 a net:Object. + ?newFeature3 net:objectType sys:Feature. + ?newFeature3 net:node ?uw3. + ?newFeature3 net:featureClass ?featureClass. + ?newFeature3 net:concept ?concept3. + # Net: Entity ClassList ?newNet a net:Instance. ?newNet net:type net:entity_class_list. ?newNet net:structure ?req. @@ -402,10 +460,12 @@ CONSTRUCT { ?newNet net:node ?uw2. ?newNet net:node ?uw3. ?newNet net:entityClass ?entityClass. - ?newNet net:featureClass ?featureClass. + # -- old --- ?newNet net:featureClass ?featureClass. ?newNet net:class1 ?mainEntity. ?newNet net:class2 ?subEntity2. ?newNet net:class2 ?subEntity3. + ?newNet net:has_feature ?newFeature2. + ?newNet net:has_feature ?newFeature3. } WHERE { # net1: entity @@ -434,21 +494,30 @@ WHERE { # --old --- ?uw1 unl:is_substructure_of ?req. # --old --- ?uw2 unl:is_substructure_of ?req. # --old --- ?uw3 unl:is_substructure_of ?req. - # Label(s) / URI - ?uw2 rdfs:label ?uw2Label. - ?uw3 rdfs:label ?uw3Label. + # Label: Id, concept, subEntity ?uw1 unl:has_id ?uw1Id. ?uw2 unl:has_id ?uw2Id. - # -- old --- ?uw3 unl:has_id ?uw3Id. + ?uw3 unl:has_id ?uw3Id. + ?uw2 rdfs:label ?uw2Label. + ?uw3 rdfs:label ?uw3Label. BIND (strbefore(?uw2Label, '(') AS ?concept2) BIND (strbefore(?uw3Label, '(') AS ?concept3) BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity2). BIND (concat(?concept3, '_', ?mainEntity) AS ?subEntity3). + # URI (for Feature Object) + cprm:Config_Parameters cprm:netURI ?netURI. + cprm:Config_Parameters cprm:objectRef ?objectRef. + BIND (concat( ?netURI, ?objectRef) AS ?f1). + BIND (concat(?f1, ?uw2Id) AS ?f2). + BIND (concat(?f1, ?uw3Id) AS ?f3). + BIND (uri(?f2) AS ?newFeature2). + BIND (uri(?f3) AS ?newFeature3). + # URI (for ClassList Net) cprm:Config_Parameters cprm:netURI ?netURI. net:class_list rdfs:label ?classListLabel. - BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). - BIND (concat(?s1, ?uw1Id, '-', ?uw2Id) AS ?s2). - BIND (uri(?s2) AS ?newNet). + BIND (concat( ?netURI, ?classListLabel, '_') AS ?n1). + BIND (concat(?n1, ?uw1Id, '-', ?uw2Id) AS ?n2). + BIND (uri(?n2) AS ?newNet). }""" ; sh:order "221"^^xsd:decimal ; . @@ -467,6 +536,18 @@ PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#> # -- Compose an Entity net and an Entity ModList net (with distinct entity classes) CONSTRUCT { + # Net Object: feature + ?newFeature2 a net:Object. + ?newFeature2 net:objectType sys:Feature. + ?newFeature2 net:node ?uw2. + ?newFeature2 net:featureClass ?entityClass2. + ?newFeature2 net:concept ?concept2. + ?newFeature3 a net:Object. + ?newFeature3 net:objectType sys:Feature. + ?newFeature3 net:node ?uw3. + ?newFeature3 net:featureClass ?entityClass2. + ?newFeature3 net:concept ?concept3. + # Net: Entity ClassList ?newNet a net:Instance. ?newNet net:type net:entity_class_list. ?newNet net:structure ?req. @@ -474,10 +555,12 @@ CONSTRUCT { ?newNet net:node ?uw2. ?newNet net:node ?uw3. ?newNet net:entityClass ?entityClass1. - ?newNet net:featureClass ?entityClass2. + # -- old --- ?newNet net:featureClass ?entityClass2. ?newNet net:class1 ?mainEntity. ?newNet net:class2 ?subEntity2. ?newNet net:class2 ?subEntity3. + ?newNet net:has_feature ?newFeature2. + ?newNet net:has_feature ?newFeature3. } WHERE { # net1: agent @@ -509,21 +592,30 @@ WHERE { # --old --- ?uw1 unl:is_substructure_of ?req. # --old --- ?uw2 unl:is_substructure_of ?req. # --old --- ?uw3 unl:is_substructure_of ?req. - # Label(s) / URI - ?uw2 rdfs:label ?uw2Label. - ?uw3 rdfs:label ?uw3Label. + # Label: Id, concept, subEntity ?uw1 unl:has_id ?uw1Id. ?uw2 unl:has_id ?uw2Id. - # -- old --- ?uw3 unl:has_id ?uw3Id. - BIND (strbefore(?uw2Label, '(') AS ?concept2). - BIND (strbefore(?uw3Label, '(') AS ?concept3). + ?uw3 unl:has_id ?uw3Id. + ?uw2 rdfs:label ?uw2Label. + ?uw3 rdfs:label ?uw3Label. + BIND (strbefore(?uw2Label, '(') AS ?concept2) + BIND (strbefore(?uw3Label, '(') AS ?concept3) BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity2). BIND (concat(?concept3, '_', ?mainEntity) AS ?subEntity3). + # URI (for Feature Object) + cprm:Config_Parameters cprm:netURI ?netURI. + cprm:Config_Parameters cprm:objectRef ?objectRef. + BIND (concat( ?netURI, ?objectRef) AS ?f1). + BIND (concat(?f1, ?uw2Id) AS ?f2). + BIND (concat(?f1, ?uw3Id) AS ?f3). + BIND (uri(?f2) AS ?newFeature2). + BIND (uri(?f3) AS ?newFeature3). + # URI (for ClassList Net) cprm:Config_Parameters cprm:netURI ?netURI. net:class_list rdfs:label ?classListLabel. - BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). - BIND (concat(?s1, ?uw1Id, '-', ?uw2Id) AS ?s2). - BIND (uri(?s2) AS ?newNet). + BIND (concat( ?netURI, ?classListLabel, '_') AS ?n1). + BIND (concat(?n1, ?uw1Id, '-', ?uw2Id) AS ?n2). + BIND (uri(?n2) AS ?newNet). }""" ; sh:order "222"^^xsd:decimal ; . @@ -542,6 +634,7 @@ PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#> # -- Compose an Entity net and an Entity ModList net (with same entity classes) CONSTRUCT { + # Net: Entity ClassList ?newNet a net:Instance. ?newNet net:type net:entity_class_list. ?newNet net:structure ?req. @@ -549,7 +642,7 @@ CONSTRUCT { ?newNet net:node ?uw2. ?newNet net:node ?uw3. ?newNet net:entityClass ?entityClass1. - ?newNet net:featureClass \"None\". + # -- old --- ?newNet net:featureClass \"None\". ?newNet net:class1 ?mainEntity. ?newNet net:class2 ?subEntity2. ?newNet net:class2 ?subEntity3. @@ -583,14 +676,15 @@ WHERE { # --old --- ?uw1 unl:is_substructure_of ?req. # --old --- ?uw2 unl:is_substructure_of ?req. # --old --- ?uw3 unl:is_substructure_of ?req. - # Label(s) / URI - ?uw2 rdfs:label ?uw2Label. - ?uw3 rdfs:label ?uw3Label. + # Label: Id, subEntity ?uw1 unl:has_id ?uw1Id. ?uw2 unl:has_id ?uw2Id. # -- old --- ?uw3 unl:has_id ?uw3Id. + ?uw2 rdfs:label ?uw2Label. + ?uw3 rdfs:label ?uw3Label. BIND (strbefore(?uw2Label, '(') AS ?subEntity2) BIND (strbefore(?uw3Label, '(') AS ?subEntity3) + # URI (for ClassList Net) cprm:Config_Parameters cprm:netURI ?netURI. net:class_list rdfs:label ?classListLabel. BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). @@ -772,7 +866,7 @@ WHERE { ?net1 net:class1 ?mainEntity. ?net1 net:class2 ?subEntity. ?net1 net:entityInstance ?mainInstance. - # Label(s) / URI + # URI (for classes) cprm:Config_Parameters cprm:baseURI ?baseURI. fprm:System_Ontology fprm:frameURI ?frameURI. fprm:System_Entity rdfs:label ?entityLabel. @@ -893,6 +987,7 @@ cts:generation sh:rule cts:add-entity-classes ; sh:rule cts:add-feature-classes ; sh:rule cts:add-list-of-entity-classes ; + sh:rule cts:complement-list-of-entity-classes ; . cts:generation_1 rdf:type cts:generation ; diff --git a/frame/system-ontology.ttl b/frame/system-ontology.ttl index ebc0360f..59e42353 100644 --- a/frame/system-ontology.ttl +++ b/frame/system-ontology.ttl @@ -16,16 +16,22 @@ sys:Entity rdfs:label "entité"@fr ; rdfs:subClassOf sys:Structure ; . +sys:Event + rdf:type owl:Class ; + rdfs:label "Event"@en ; + rdfs:label "Evénèment"@fr ; + rdfs:subClassOf sys:Structure ; +. sys:Feature rdf:type owl:Class ; rdfs:label "caractéristique"@fr ; rdfs:label "feature"@en ; rdfs:subClassOf sys:Structure ; . -sys:Property +sys:State_Property rdf:type owl:Class ; - rdfs:label "property"@en ; - rdfs:label "propriété"@fr ; + rdfs:label "Propriété d'état"@fr ; + rdfs:label "State Property"@en ; rdfs:subClassOf sys:Structure ; . sys:Structure @@ -44,11 +50,35 @@ sys:component rdfs:label "composant"@fr ; rdfs:subClassOf sys:Entity ; . -sys:event - rdf:type owl:Class ; - rdfs:label "action "@en ; - rdfs:label "action "@fr ; - rdfs:subClassOf sys:Property ; +sys:entityProperty + rdf:type rdf:Property ; + rdfs:label "entity property" ; + rdfs:subPropertyOf sys:property ; +. +sys:eventProperty + rdf:type rdf:Property ; + rdfs:label "event property" ; + rdfs:subPropertyOf sys:property ; +. +sys:has_actor + rdf:type rdf:Property ; + rdfs:label "has actor" ; + rdfs:subPropertyOf sys:eventProperty ; +. +sys:has_feature + rdf:type rdf:Property ; + rdfs:label "feature" ; + rdfs:subPropertyOf sys:entityProperty ; +. +sys:has_target + rdf:type rdf:Property ; + rdfs:label "has target" ; + rdfs:subPropertyOf sys:eventProperty ; +. +sys:has_verb + rdf:type rdf:Property ; + rdfs:label "has verb" ; + rdfs:subPropertyOf sys:eventProperty ; . sys:message rdf:type owl:Class ; @@ -66,9 +96,3 @@ sys:property rdf:type rdf:Property ; rdfs:label "System Property" ; . -sys:state - rdf:type owl:Class ; - rdfs:label "attribut"@fr ; - rdfs:label "attribute "@en ; - rdfs:subClassOf sys:Property ; -. -- GitLab