diff --git a/config/transduction-schemes.ttl b/config/transduction-schemes.ttl index 70b19cc20a671728f5fc090323818f18d2bcc4a2..755fcaf6b6078efbc2dcb706e3af075bd1e40f50 100644 --- a/config/transduction-schemes.ttl +++ b/config/transduction-schemes.ttl @@ -220,7 +220,7 @@ WHERE { BIND (uri(?s5) AS ?subEntity23Uri). FILTER ( ?mainEntity1 = ?subEntityNet2). }""" ; - sh:order "000"^^xsd:decimal ; + sh:order "999"^^xsd:decimal ; . cts:add-entity-classes rdf:type sh:SPARQLRule ; @@ -341,20 +341,6 @@ WHERE { } """ ; sh:order "001"^^xsd:decimal ; . -cts:classification - rdf:type owl:Class ; - rdf:type sh:NodeShape ; - rdfs:label "generation" ; - rdfs:subClassOf cts:generation ; - sh:rule cts:add-conjunctive-entity-classes ; - sh:rule cts:add-disjunctive-entity-classes ; - sh:rule cts:add-entity-classes ; - sh:rule cts:add-list-of-entity-classes ; -. -cts:classification_1 - rdf:type cts:classification ; - rdfs:label "classification 1" ; -. cts:compose-entity-modlist-1 rdf:type sh:SPARQLRule ; sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#> @@ -412,6 +398,9 @@ WHERE { # Label(s) / URI ?uw2 rdfs:label ?uw2Label. ?uw3 rdfs:label ?uw3Label. + ?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) BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity2). @@ -419,7 +408,7 @@ WHERE { cprm:Config_Parameters cprm:netURI ?netURI. net:class_list rdfs:label ?classListLabel. BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). - BIND (concat(?s1, ?mainEntity, '-', ?concept2) AS ?s2). + BIND (concat(?s1, ?uw1Id, '-', ?uw2Id) AS ?s2). BIND (uri(?s2) AS ?newNet). }""" ; sh:order "121"^^xsd:decimal ; @@ -484,6 +473,9 @@ WHERE { # Label(s) / URI ?uw2 rdfs:label ?uw2Label. ?uw3 rdfs:label ?uw3Label. + ?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). BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity2). @@ -491,7 +483,7 @@ WHERE { cprm:Config_Parameters cprm:netURI ?netURI. net:class_list rdfs:label ?classListLabel. BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). - BIND (concat(?s1, ?mainEntity, '-', ?subEntity2) AS ?s2). + BIND (concat(?s1, ?uw1Id, '-', ?uw2Id) AS ?s2). BIND (uri(?s2) AS ?newNet). }""" ; sh:order "122"^^xsd:decimal ; @@ -555,12 +547,15 @@ WHERE { # Label(s) / URI ?uw2 rdfs:label ?uw2Label. ?uw3 rdfs:label ?uw3Label. + ?uw1 unl:has_id ?uw1Id. + ?uw2 unl:has_id ?uw2Id. + # -- old --- ?uw3 unl:has_id ?uw3Id. BIND (strbefore(?uw2Label, '(') AS ?subEntity2) BIND (strbefore(?uw3Label, '(') AS ?subEntity3) cprm:Config_Parameters cprm:netURI ?netURI. net:class_list rdfs:label ?classListLabel. BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). - BIND (concat(?s1, ?mainEntity, '-', ?subEntity2) AS ?s2). + BIND (concat(?s1, ?uw1Id, '-', ?uw2Id) AS ?s2). BIND (uri(?s2) AS ?newNet). }""" ; sh:order "123"^^xsd:decimal ; @@ -598,16 +593,47 @@ WHERE { # ------ ?uw1 unl:is_occurrence_of ?lexTrg. # Label(s) / URI ?uw1 rdfs:label ?uw1Label. + ?uw1 unl:has_id ?uw1Id. cprm:Config_Parameters cprm:netURI ?netURI BIND (strbefore(?uw1Label, '(') AS ?concept1). BIND (concat( ?netURI, ?entityClass, '_') AS ?s1). - BIND (concat(?s1, ?concept1) AS ?s2). + BIND (concat(?s1, ?uw1Id) AS ?s2). BIND (uri(?s2) AS ?semNet). # Filter FILTER ( regex(str(?uw1Label),str(?entityRestriction)) ). }""" ; sh:order "101"^^xsd:decimal ; . +cts:define-uw-id + 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#> + +# -- Define an ID for each UW (occurrence) +CONSTRUCT { + ?uw1 unl:has_id ?uwId. +} +WHERE { + # UW: type UW-Occurrence and substructure of req sentence + ?uw1 rdf:type unl:UW_Occurrence. + ?uw1 unl:is_substructure_of ?req. + # Label(s) / URI + ?req unl:has_id ?reqId. + ?uw1 rdfs:label ?uw1Label. + BIND (strbefore(?uw1Label, '(') AS ?concept1). + BIND (strafter(str(?uw1), \"---\") AS ?numOcc). + BIND (concat( ?reqId, '_', ?concept1, ?numOcc) AS ?uwId). +} """ ; + sh:order "003"^^xsd:decimal ; +. cts:dev_schemes rdf:type owl:Class ; rdf:type sh:NodeShape ; @@ -635,7 +661,7 @@ cts:entity_extraction_1 rdf:type cts:entity_extraction ; rdfs:label "entity extraction 1" ; . -cts:extend-instantiation-to-subclasses +cts:extend-instantiation-to-subclasses--old rdf:type sh:SPARQLRule ; rdfs:label "Extend Instantiatiation to Entity SubClasses" ; sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#> @@ -676,7 +702,7 @@ WHERE { BIND (uri(?s3) AS ?subEntityUri). BIND (uri(?s4) AS ?mainInstanceUri). }""" ; - sh:order "302"^^xsd:decimal ; + sh:order "999"^^xsd:decimal ; . cts:extend-list-of-entity-classes--old rdf:type sh:SPARQLRule ; @@ -723,7 +749,7 @@ WHERE { # -- old --- FILTER ( ?mainEntity1 = ?subEntity2 ). # -- old --- FILTER ( ?mainEntity1 != ?subEntity2 ). }""" ; - sh:order "000"^^xsd:decimal ; + sh:order "999"^^xsd:decimal ; . cts:extend-mod-list rdf:type sh:SPARQLRule ; @@ -768,6 +794,14 @@ cts:generation rdf:type sh:NodeShape ; rdfs:label "generation" ; rdfs:subClassOf cts:Transduction_Schemes ; + sh:rule cts:add-conjunctive-entity-classes ; + sh:rule cts:add-disjunctive-entity-classes ; + sh:rule cts:add-entity-classes ; + sh:rule cts:add-list-of-entity-classes ; +. +cts:generation_1 + rdf:type cts:generation ; + rdfs:label "generation 1" ; . cts:init-mod-list rdf:type sh:SPARQLRule ; @@ -801,12 +835,13 @@ WHERE { ?uw1 unl:is_substructure_of ?req. # Label(s) / URI ?uw1 rdfs:label ?uw1Label. + ?uw1 unl:has_id ?uw1Id. cprm:Config_Parameters cprm:netURI ?netURI. net:mod_list rdfs:label ?modListLabel. BIND (strbefore(?uw1Label, '(') AS ?concept1). - BIND (strbefore(?uw2Label, '(') AS ?concept2). + # -- old --- BIND (strbefore(?uw2Label, '(') AS ?concept2). BIND (concat( ?netURI, ?modListLabel, '_') AS ?s1). - BIND (concat(?s1, ?concept1) AS ?s2). + BIND (concat(?s1, ?uw1Id) AS ?s2). BIND (uri(?s2) AS ?semNet). }""" ; sh:order "111"^^xsd:decimal ; @@ -883,7 +918,7 @@ WHERE { }""" ; sh:order "125"^^xsd:decimal ; . -cts:instantiate-entity-classes +cts:instantiate-entity-classes--old rdf:type sh:SPARQLRule ; rdfs:label "Instantiate Entity Classes" ; sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#> @@ -922,7 +957,7 @@ WHERE { # Filter: entity not present in a class list FILTER NOT EXISTS { ?net2 net:class2 ?mainEntity} }""" ; - sh:order "301"^^xsd:decimal ; + sh:order "999"^^xsd:decimal ; . cts:instantiate-entity-net rdf:type sh:SPARQLRule ; @@ -957,18 +992,11 @@ WHERE { # -- old ---- ?uw1 unl:is_substructure_of ?req. # -- old ---- ?uw1 unl:is_occurrence_of ?lexTrg. # Label(s) / URI - BIND (concat(?concept1, '_instance') AS ?instanceName). + ?uw1 unl:has_id ?uw1Id. + BIND (?uw1Id AS ?instanceName). }""" ; sh:order "102"^^xsd:decimal ; . -cts:instantiation - rdf:type owl:Class ; - rdf:type sh:NodeShape ; - rdfs:label "instantiation" ; - rdfs:subClassOf cts:generation ; - sh:rule cts:extend-instantiation-to-subclasses ; - sh:rule cts:instantiate-entity-classes ; -. cts:link-to-scope-entry rdf:type sh:SPARQLRule ; sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#> @@ -1012,32 +1040,6 @@ cts:preprocessing sh:rule cts:bypass-reification ; sh:rule cts:link-to-scope-entry ; . -cts:preprocessing_1 - rdf:type cts:preprocessing ; - rdfs:label "preprocessing 1" ; -. -cts:test_1 - rdf:type sh:SPARQLRule ; - rdfs:label "test 1" ; - 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#> - -CONSTRUCT { - ?net1 a net:Instance. -} -WHERE { - ?net1 a net:Instance. -}""" ; - sh:order "000"^^xsd:decimal ; -. cts:typify-modlist-entity rdf:type sh:SPARQLRule ; sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#>