diff --git a/CHANGELOG b/CHANGELOG index 029fdce916217331a7ea173927acb1cb55319f24..1113621d913909829ef8a5bf46f50b112354375e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -5,9 +5,10 @@ All notable changes to this project will be documented in this file. ------------------------------------------------------------------------------- -## [0.2.0] - 2021-09-28 +## [0.2.0] - 2021-10-25 DGA Demo ### Added +- Query to define URIs in net objects (net: Object) ### Changed - Fusion of CTS for atom elements (entity, feature, verb, ...) @@ -17,7 +18,7 @@ All notable changes to this project will be documented in this file. ------------------------------------------------------------------------------- -## [0.1.3] - 2021-09-17 Demo CS 2 +## [0.1.3] - 2021-09-17 CS Demo 2 ### Added - Relation between classes/instances and requirements @@ -29,7 +30,7 @@ All notable changes to this project will be documented in this file. - Order of CTS (Compositional Transduction Schemes) -## [0.1.2] - 2021-09-08 Demo CS 1 +## [0.1.2] - 2021-09-08 CS Demo 1 ### Added - Transduction Schemes to extract Entity classes and instances diff --git a/config/semantic-net.ttl b/config/semantic-net.ttl index f488ec67b13ed4ba25e078acbe1895cabae83593..01b1302122ae5cb536555bb94df94d9bf6c47742 100644 --- a/config/semantic-net.ttl +++ b/config/semantic-net.ttl @@ -150,6 +150,11 @@ net:has_mother_class rdfs:label "has mother class" ; rdfs:subPropertyOf net:objectValue ; . +net:has_mother_class_uri + rdf:type rdf:Property ; + rdfs:label "parent class uri" ; + rdfs:subPropertyOf net:objectValue ; +. net:has_node rdf:type rdf:Property ; rdfs:label "UNL Node" ; diff --git a/config/transduction-schemes.ttl b/config/transduction-schemes.ttl index 11b542b6b0a8ee0fe7c94a5f697ed3cc98554f24..cd86ffa1b7cfaf44e89b1c76f28637b6fb0a8bd4 100644 --- a/config/transduction-schemes.ttl +++ b/config/transduction-schemes.ttl @@ -85,17 +85,17 @@ WHERE { BIND (concat(?concept23, '_', ?mainEntity) AS ?subEntity23). # URI (for classes) sys:Structure sys:has_frame_uri ?frameURI. - BIND (concat( ?frameURI, ?parentClass) AS ?s1). - BIND (concat(?s1, '#', ?mainEntity) AS ?s2). - BIND (concat(?s1, '#', ?subEntity2) AS ?s3). - BIND (concat(?s1, '#', ?subEntity3) AS ?s4). - BIND (concat(?s1, '#', ?subEntity23) AS ?s5). + BIND (concat( ?frameURI, ?parentClass) AS ?s1). # -- old --- BIND (concat( ?frameURI, ?parentClass) AS ?s1). + BIND (concat(?frameURI, ?mainEntity) AS ?s2). # -- old --- BIND (concat(?s1, '#', ?mainEntity) AS ?s2). + BIND (concat(?frameURI, ?subEntity2) AS ?s3). # -- old --- BIND (concat(?s1, '#', ?subEntity2) AS ?s3). + BIND (concat(?frameURI, ?subEntity3) AS ?s4). # -- old --- BIND (concat(?s1, '#', ?subEntity3) AS ?s4). + BIND (concat(?frameURI, ?subEntity23) AS ?s5). # -- old --- BIND (concat(?s1, '#', ?subEntity23) AS ?s5). BIND (uri(?s2) AS ?mainEntityUri). BIND (uri(?s3) AS ?subEntity2Uri). BIND (uri(?s4) AS ?subEntity3Uri). BIND (uri(?s5) AS ?subEntity23Uri). # URI (for instance) - BIND (concat(?s1, '_', ?mainInstance) AS ?s6). + BIND (concat(?s1, '#', ?mainInstance) AS ?s6). BIND (uri(?s6) AS ?mainInstanceUri). }""" ; sh:order 3.4 ; @@ -155,17 +155,17 @@ WHERE { BIND (concat(?concept23, '_', ?mainEntity) AS ?subEntity23). # URI (for classes) sys:Structure sys:has_frame_uri ?frameURI. - BIND (concat( ?frameURI, ?parentClass) AS ?s1). - BIND (concat(?s1, '#', ?mainEntity) AS ?s2). - BIND (concat(?s1, '#', ?subEntity2) AS ?s3). - BIND (concat(?s1, '#', ?subEntity3) AS ?s4). - BIND (concat(?s1, '#', ?subEntity23) AS ?s5). + BIND (concat( ?frameURI, ?parentClass) AS ?s1). # -- old --- BIND (concat( ?frameURI, ?parentClass) AS ?s1). + BIND (concat(?frameURI, ?mainEntity) AS ?s2). # -- old --- BIND (concat(?s1, '#', ?mainEntity) AS ?s2). + BIND (concat(?frameURI, ?subEntity2) AS ?s3). # -- old --- BIND (concat(?s1, '#', ?subEntity2) AS ?s3). + BIND (concat(?frameURI, ?subEntity3) AS ?s4). # -- old --- BIND (concat(?s1, '#', ?subEntity3) AS ?s4). + BIND (concat(?frameURI, ?subEntity23) AS ?s5). # -- old --- BIND (concat(?s1, '#', ?subEntity23) AS ?s5). BIND (uri(?s2) AS ?mainEntityUri). BIND (uri(?s3) AS ?subEntity2Uri). BIND (uri(?s4) AS ?subEntity3Uri). BIND (uri(?s5) AS ?subEntity23Uri). # URI (for instance) - BIND (concat(?s1, '_', ?mainInstance) AS ?s6). + BIND (concat(?s1, '#', ?mainInstance) AS ?s6). BIND (uri(?s6) AS ?mainInstanceUri). }""" ; sh:order 3.4 ; @@ -309,24 +309,6 @@ WHERE { BIND (concat(?o1, '#', ?verbConcept) AS ?o2). BIND (uri( ?o1) AS ?statePropertyObjectPropertyUri). BIND (uri( ?o2) AS ?newStatePropertyObjectPropertyUri). - # URI (for instance) - # -- old --- BIND (concat( ?frameURI, ?eventClass) AS ?i1). - # -- old --- BIND (concat(?i1, '_', ?mainInstance) AS ?i2). - # -- old --- BIND (uri(?i2) AS ?mainInstanceUri). - # URI (for Entity classes) - # -- old --- fprm:System_Ontology fprm:frameURI ?frameURI. - # -- old --- BIND (concat( ?frameURI, ?actorClass) AS ?e1a). - # -- old --- BIND (concat(?e1a, '#', ?actorConcept) AS ?e1b). - # -- old --- BIND (concat(?e1a, '_', ?actorInstance) AS ?e1c). - # -- old --- BIND (uri(?e1a) AS ?actorClassUri). - # -- old --- BIND (uri(?e1b) AS ?actorUri). - # -- old --- BIND (uri(?e1c) AS ?actorInstanceUri). - # -- old --- BIND (concat( ?frameURI, ?targetClass) AS ?e2a). - # -- old --- BIND (concat(?e2a, '#', ?targetConcept) AS ?e2b). - # -- old --- BIND (concat(?e2a, '_', ?targetInstance) AS ?e2c). - # -- old --- BIND (uri(?e2a) AS ?targetClassUri). - # -- old --- BIND (uri(?e2b) AS ?targetUri). - # -- old --- BIND (uri(?e2c) AS ?targetInstanceUri). }""" ; sh:order 3.1 ; . @@ -429,12 +411,12 @@ WHERE { ?featureObject net:has_concept ?featureConcept. # URI: entity class sys:Structure sys:has_frame_uri ?frameURI. - BIND (concat( ?frameURI, ?parentClass) AS ?c1). - BIND (concat(?c1, '#', ?subEntity) AS ?c2). + # -- old --- BIND (concat( ?frameURI, ?parentClass) AS ?c1). + BIND (concat(?frameURI, ?subEntity) AS ?c2). # -- old --- 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). + # -- old --- BIND (concat( ?frameURI, ?featureClass) AS ?f1). + BIND (concat(?frameURI, ?featureConcept) AS ?f2). # -- old --- BIND (concat(?f1, '#', ?featureConcept) AS ?f2). BIND (uri(?f2) AS ?featureUri). }""" ; sh:order 3.3 ; @@ -746,20 +728,25 @@ PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#> # -- Compute useful URI CONSTRUCT { # Net Object URI + ?object net:has_mother_class_uri ?motherClassUri. ?object net:has_parent_class_uri ?parentClassUri. ?object net:has_class_uri ?objectClassUri. } WHERE { # object ?object a net:Object. - ?object net:has_parent_class ?objectParentClass. + ?object net:has_mother_class ?motherClass. + ?object net:has_parent_class ?parentClass. ?object net:has_class ?objectClass. # URI (for classes) - sys:Structure sys:has_frame_uri ?frameURI. - BIND (concat( ?frameURI, ?objectParentClass) AS ?s1). - BIND (concat(?s1, '#', ?objectClass) AS ?s2). - BIND (uri( ?s1) AS ?parentClassUri). - BIND (uri(?s2) AS ?objectClassUri). + sys:Structure sys:has_frame_uri ?frameURI. + BIND (str(?motherClass) AS ?s1). # -- old --- BIND (concat( ?frameURI, ?parentClass) AS ?s1). + # TODO: BIND (concat( ?frameURI, ?motherClass) AS ?s1). + BIND (concat(?frameURI, ?parentClass) AS ?s2). # -- old --- BIND (concat(?s1, '#', ?parentClass) AS ?s2). + BIND (concat(?frameURI, ?objectClass) AS ?s3). # -- old --- BIND (concat(?s1, '#', ?objectClass) AS ?s3). + BIND (uri( ?s1) AS ?motherClassUri). + BIND (uri( ?s2) AS ?parentClassUri). + BIND (uri(?s3) AS ?objectClassUri). }""" ; sh:order 3.01 ; . @@ -901,13 +888,13 @@ CONSTRUCT { WHERE { # object ?object a net:Object. - ?object net:has_parent_class ?objectParentClass. + ?object net:has_parent_class ?parentClass. ?object net:has_instance ?objectInstance. # URI (for classes and instance) sys:Structure sys:has_frame_uri ?frameURI. - BIND (concat( ?frameURI, ?objectParentClass) AS ?s1). - BIND (concat(?s1, '_', ?objectInstance) AS ?s3). - BIND (uri(?s3) AS ?objectInstanceUri). + BIND (concat( ?frameURI, ?parentClass) AS ?s1). + BIND (concat(?s1, '#', ?objectInstance) AS ?s2). + BIND (uri(?s2) AS ?objectInstanceUri). }""" ; sh:order 3.02 ; . @@ -1158,12 +1145,6 @@ WHERE { ?net2 net:listOf net:composite. ?net2 net:has_item ?atomObject1. } - # URI: class - # -- old --- sys:Structure sys:has_frame_uri ?frameURI. - # -- old --- BIND (concat( ?frameURI, ?atomParentClass) AS ?s1). - # -- old --- BIND (concat(?s1, '#', ?atomConcept) AS ?s2). - # -- old --- BIND (uri( ?s1) AS ?parentUri). - # -- old --- BIND (uri(?s2) AS ?newClassUri). }""" ; sh:order 3.1 ; . @@ -1189,26 +1170,16 @@ CONSTRUCT { ?newInstanceUri sys:from_structure ?req. } WHERE { - # net1: entity + # net1: atom ?net1 a net:Instance. ?net1 net:type net:atom. - ?net1 net:atomOf sys:Entity. ?net1 net:has_structure ?req. ?net1 net:has_atom ?atomObject1. - ?atomObject1 net:has_parent_class ?atomParentClass. - ?atomObject1 net:has_concept ?atomConcept. + ?atomObject1 net:has_class_uri ?classUri. ?atomObject1 net:has_instance ?atomInstance. + ?atomObject1 net:has_instance_uri ?newInstanceUri. # Filter: entity not present in a class list FILTER NOT EXISTS { ?net2 net:has_subClass ?atomConcept} - # URI (for classes) - sys:Structure sys:has_frame_uri ?frameURI. - BIND (concat( ?frameURI, ?atomParentClass) AS ?s1). - BIND (concat(?s1, '#', ?atomConcept) AS ?s2). - BIND (uri( ?s1) AS ?parentUri). - BIND (uri(?s2) AS ?classUri). - # URI (for instance) - BIND (concat(?s1, '_', ?atomInstance) AS ?s3). - BIND (uri(?s3) AS ?newInstanceUri). }""" ; sh:order 3.1 ; . @@ -1241,23 +1212,23 @@ WHERE { ?net1 net:type net:list. ?net1 net:listOf net:composite. ?net1 net:has_structure ?req. - # -- old --- ?net1 net:entityClass ?entityClass. - ?net1 net:has_parent ?parentObject. # -- old --- ?mainEntityObject. - ?parentObject net:has_parent_class ?parentClass. # -- old --- ?entityClass. - ?parentObject net:has_concept ?parentConcept. # -- old --- ?mainEntity. + ?net1 net:has_parent ?parentObject. + # -- old --- ?parentObject net:has_mother_class ?motherClass. + ?parentObject net:has_parent_class ?parentClass. + ?parentObject net:has_concept ?parentConcept. ?net1 net:has_item ?compositeObject. - ?compositeObject net:has_concept ?compositeConcept. #-- old --- ?subEntity + ?compositeObject net:has_concept ?compositeConcept. ?compositeObject net:has_instance ?compositeInstance. # Filter -- old --- FILTER NOT EXISTS { ?net2 net:has_subClass ?mainEntity} # URI (for classes) sys:Structure sys:has_frame_uri ?frameURI. - BIND (concat( ?frameURI, ?parentClass) AS ?s1). - BIND (concat(?s1, '#', ?parentConcept) AS ?s2). - BIND (concat(?s1, '#', ?compositeConcept) AS ?s3). - BIND (uri(?s2) AS ?parentUri). # -- old --- ?mainEntityUri). - BIND (uri(?s3) AS ?newClassUri). # -- old --- ?subEntityUri). + BIND (concat( ?frameURI, ?parentConcept) AS ?s2). # -- old --- BIND (concat(?s1, '#', ?parentConcept) AS ?s2). + BIND (concat( ?frameURI, ?compositeConcept) AS ?s3). # -- old --- BIND (concat(?s1, '#', ?compositeConcept) AS ?s3). + BIND (uri(?s2) AS ?parentUri). + BIND (uri(?s3) AS ?newClassUri). # URI (for instance) - BIND (concat(?s1, '_', ?compositeInstance) AS ?s4). + BIND (concat( ?frameURI, ?parentClass) AS ?s1). + BIND (concat(?s1, '#', ?compositeInstance) AS ?s4). BIND (uri(?s4) AS ?instanceUri). }""" ; sh:order 3.2 ; diff --git a/frame/system-ontology.ttl b/frame/system-ontology.ttl index 4b87f86ba3272123849f90c9a68dc7e34fd01609..adece0d41104258194008cead74b8d0352d92276 100644 --- a/frame/system-ontology.ttl +++ b/frame/system-ontology.ttl @@ -117,6 +117,7 @@ sys:component sys:has_restriction "icl>instrumentality" ; sys:has_restriction "icl>position" ; sys:has_restriction "icl>public_transport" ; + sys:has_restriction "icl>structure" ; sys:is_class "component" ; . sys:entityClassProperty diff --git a/prepare_work_data.py b/prepare_work_data.py index ed215f3d711cee3d3bba324a0d5e82a08543f1ca..50f145064e310e77059e17f6c76b501cb00c6a42 100644 --- a/prepare_work_data.py +++ b/prepare_work_data.py @@ -34,9 +34,6 @@ schema_file = "unl-rdf-schema.ttl" semantic_net_file = "semantic-net.ttl" cts_file = "transduction-schemes.ttl" c_param_file = "config-parameters.ttl" -# -- old --- req_onto_file = "requirement" + ONTO_FILE -# -- old --- sys_onto_file = "system" + ONTO_FILE -# -- old --- f_param_file = "ontology-parameters.ttl" # Dev Tests base_uri = "https://unsel.tetras-libre.fr/tenet/working" @@ -210,7 +207,7 @@ if __name__ == '__main__': #run(req_100, 'R100b', target_ref) #run(req_200, 'R200b', target_ref) run(req_300, 'R300b', target_ref) - run(corpus_40, 'Corpus-CCTP-40c', target_ref) + #run(corpus_40, 'Corpus-CCTP-40c', target_ref) #run(corpus_ERTMS, 'Corpus-ERTMS', target_ref) #run(corpus_PEV, 'Corpus-PEV', target_ref)