diff --git a/.gitignore b/.gitignore index 7d164cee8e599aae58ac48541776441356e310e3..9277bf02876166ced3ff7cb07b4a6d5ed84dec49 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ __pycache__ *.todo devtemp*.py corpus/CCTP-SRSA-IP* +.project diff --git a/README.md b/README.md index 2cd9b253391ea00ee39ef068bd645eee12773d1c..bf4441a0fd6471bc1d255fb4e516b8cac51a5262 100644 --- a/README.md +++ b/README.md @@ -74,7 +74,7 @@ Following commands are proposed to execute the different steps of the process: - **select**: command to select a corpus. - **load**: command to load the UNL sentences of a given corpus. - - **extraction**: command to extract terminologies data from UNL-RDF graph. + - **extract**: command to extract terminologies data from UNL-RDF graph. - **reason**: command to reason on terminology. - **clean**: command to clean the working directories. diff --git a/config/transduction-schemes.ttl b/config/transduction-schemes.ttl new file mode 100644 index 0000000000000000000000000000000000000000..ab74a3a0ea5bf185b5376c1f6bb7254ffef47176 --- /dev/null +++ b/config/transduction-schemes.ttl @@ -0,0 +1,603 @@ +# baseURI: https://unsel.tetras-libre.fr/tenet/transduction-schemes +# imports: http://datashapes.org/dash +# imports: https://unl.tetras-libre.fr/rdf/schema +# imports: https://unsel.tetras-libre.fr/tenet/config/parameters +# imports: https://unsel.tetras-libre.fr/tenet/frame/parameters +# imports: https://unsel.tetras-libre.fr/tenet/frame/requirement-ontology +# imports: https://unsel.tetras-libre.fr/tenet/frame/system-ontology +# imports: https://unsel.tetras-libre.fr/tenet/semantic-net +# prefix: cts + +@prefix cts: <https://unsel.tetras-libre.fr/tenet/transduction-schemes#> . +@prefix dash: <http://datashapes.org/dash#> . +@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 sh: <http://www.w3.org/ns/shacl#> . +@prefix unl: <https://unl.tetras-libre.fr/rdf/schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +sh:SPARQLRule + rdfs:subClassOf owl:Thing ; +. +<https://unsel.tetras-libre.fr/tenet/transduction-schemes> + rdf:type owl:Ontology ; + owl:imports <http://datashapes.org/dash> ; + owl:imports <https://unl.tetras-libre.fr/rdf/schema> ; + owl:imports <https://unsel.tetras-libre.fr/tenet/config/parameters> ; + owl:imports <https://unsel.tetras-libre.fr/tenet/frame/parameters> ; + owl:imports <https://unsel.tetras-libre.fr/tenet/frame/requirement-ontology> ; + owl:imports <https://unsel.tetras-libre.fr/tenet/frame/system-ontology> ; + owl:imports <https://unsel.tetras-libre.fr/tenet/semantic-net> ; +. +cts:Transduction_Schemes + rdf:type owl:Class ; + rdf:type sh:NodeShape ; + rdfs:label "Transduction Schemes" ; + rdfs:subClassOf owl:Thing ; +. +cts:add-disjunctive-entity-classes + rdf:type sh:SPARQLRule ; + rdfs:label "add-disjunctive-entity-classes" ; + 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#> + +# -- Add Disjunctive Entity classes in System Ontology +CONSTRUCT { + ?subEntity23Uri rdfs:subClassOf ?mainEntityUri. + ?subEntity23Uri rdfs:label ?subEntity23. + ?subEntity23Uri + owl:equivalentClass [ a owl:Class ; + owl:unionOf ( ?subEntity2Uri ?subEntity3Uri ) ] . +} +WHERE { + # net1: entity class list + ?net1 a net:Instance. + ?net1 net:type net:entity_class_list. + ?net1 net:entityClass ?entityClass. + ?net1 net:node ?uw2. + ?net1 net:node ?uw3. + ?net1 net:class1 ?mainEntity. + # extension: disjunction of UW + ?uw2 unl:or ?uw3. + # Label(s) / URI + ?uw2 rdfs:label ?uw2Label. + ?uw3 rdfs:label ?uw3Label. + BIND (strbefore(?uw2Label, '(') AS ?concept2) + BIND (strbefore(?uw3Label, '(') AS ?concept3) + BIND (concat(?concept2, '-or-', ?concept3) AS ?concept23) + BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity2). + BIND (concat(?concept3, '_', ?mainEntity) AS ?subEntity3). + BIND (concat(?concept23, '_', ?mainEntity) AS ?subEntity23). + cprm:Config_Parameters cprm:baseURI ?baseURI. + fprm:System_Ontology fprm:frameURI ?frameURI. + BIND (concat( ?frameURI, ?entityClass) 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 (uri(?s2) AS ?mainEntityUri). + BIND (uri(?s3) AS ?subEntity2Uri). + BIND (uri(?s4) AS ?subEntity3Uri). + BIND (uri(?s5) AS ?subEntity23Uri). +}""" ; + sh:order "203"^^xsd:decimal ; +. +cts:add-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#> + +# -- Query to add Entity classes in System Ontology +CONSTRUCT { + ?mainEntityUri rdfs:subClassOf ?entityUri. + ?subEntityUri rdfs:subClassOf ?mainEntityUri. + ?mainEntityUri rdfs:label ?mainEntity. + ?subEntityUri rdfs:label ?subEntity. +} +WHERE { + # net1: entity class list + ?net1 a net:Instance. + ?net1 net:type net:entity_class_list. + ?net1 net:entityClass ?entityClass. + ?net1 net:class1 ?mainEntity. + ?net1 net:class2 ?subEntity. + # Label(s) / URI + cprm:Config_Parameters cprm:baseURI ?baseURI. + fprm:System_Ontology fprm:frameURI ?frameURI. + fprm:System_Entity rdfs:label ?entityLabel. + BIND (concat( ?frameURI, ?entityClass) AS ?s1). + BIND (concat(?s1, '_', ?mainEntity) AS ?s2). + BIND (concat(?s1, '_', ?subEntity) AS ?s3). + BIND (uri( ?s1) AS ?entityUri). + BIND (uri(?s2) AS ?mainEntityUri). + BIND (uri(?s3) AS ?subEntityUri). + FILTER NOT EXISTS { ?net2 net:class2 ?mainEntity} +}""" ; + sh:order "201"^^xsd:decimal ; +. +cts:bypass-reification + 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#> + +# -- Request to extend UNL relation +CONSTRUCT { + ?node1 ?unlRel ?node2. +} +WHERE { + ?rel unl:has_source ?node1. + ?rel unl:has_target ?node2. + ?rel a ?unlRel. +} """ ; + sh:order "001"^^xsd:decimal ; +. +cts:compose-entity-modlist-1 + 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#> + +# -- Compose an Entity net and a Complement ModList net +CONSTRUCT { + ?newNet a net:Instance. + ?newNet net:type net:entity_class_list. + ?newNet net:node ?uw1. + ?newNet net:node ?uw2. + ?newNet net:node ?uw3. + ?newNet net:entityClass ?entityClass. + ?newNet net:featureClass ?featureClass. + ?newNet net:class1 ?mainEntity. + ?newNet net:class2 ?subEntity2. + ?newNet net:class2 ?subEntity3. +} +WHERE { + # UW: type UW-Occurrence and substructure of req sentence + ?uw1 rdf:type unl:UW_Occurrence. + ?uw2 rdf:type unl:UW_Occurrence. + ?uw3 rdf:type unl:UW_Occurrence. + ?uw1 unl:is_substructure_of ?req. + ?uw2 unl:is_substructure_of ?req. + ?uw3 unl:is_substructure_of ?req. + # net1: entity + ?net1 a net:Instance. + ?net1 net:type net:entity. + ?net1 net:node ?uw1. + ?net1 net:entityClass ?entityClass. + ?net1 net:concept ?mainEntity. + # net2: complement modList + ?net2 a net:Instance. + ?net2 net:type net:complement_mod_list. + ?net2 net:node ?uw2. + ?net2 net:node ?uw3. + ?net2 net:featureClass ?featureClass. + ?net2 net:concept ?subComplement. + # condition: mod(net1, net2) + ?uw1 unl:mod ?uw2. + # Label(s) / URI + ?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). + 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 (uri(?s2) AS ?newNet). + # Filter + FILTER ( ?uw1 != ?uw3 ). +}""" ; + sh:order "106"^^xsd:decimal ; +. +cts:compose-entity-modlist-2 + 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#> + +# -- Compose an Entity net and an Entity ModList net +CONSTRUCT { + ?newNet a net:Instance. + ?newNet net:type net:entity_class_list. + ?newNet net:node ?uw1. + ?newNet net:node ?uw2. + ?newNet net:node ?uw3. + ?newNet net:entityClass ?entityClass1. + ?newNet net:class1 ?mainEntity. + ?newNet net:class2 ?subEntity2. + ?newNet net:class2 ?subEntity3. +} +WHERE { + # UW: type UW-Occurrence and substructure of req sentence + ?uw1 rdf:type unl:UW_Occurrence. + ?uw2 rdf:type unl:UW_Occurrence. + ?uw3 rdf:type unl:UW_Occurrence. + ?uw1 unl:is_substructure_of ?req. + ?uw2 unl:is_substructure_of ?req. + ?uw3 unl:is_substructure_of ?req. + # net1: agent + ?net1 a net:Instance. + ?net1 net:type net:entity. + ?net1 net:node ?uw1. + ?net1 net:entityClass ?entityClass1. + ?net1 net:concept ?mainEntity. + # net2: complement modList + ?net2 a net:Instance. + ?net2 net:type net:entity_mod_list. + ?net2 net:node ?uw2. + ?net2 net:node ?uw3. + ?net2 net:entityClass ?entityClass2. + # condition: mod(net1, net2) + ?uw1 unl:mod ?uw2. + # Label(s) / URI + ?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). + 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 (uri(?s2) AS ?newNet). + # Filter + FILTER ( ?uw1 != ?uw3 ). +}""" ; + sh:order "107"^^xsd:decimal ; +. +cts:create-entity-net + 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#> + +# -- Query to create Entity net +CONSTRUCT { + ?semNet a net:Instance. + ?semNet net:type net:entity. + ?semNet net:node ?uw1. + ?semNet net:entityClass ?entityClass. + ?semNet net:concept ?concept1. +} +WHERE { + # Entity (from System Ontology) + ?entity rdf:type fprm:System_Entity. + ?entity fprm:class ?entityClass. + ?entity fprm:restriction ?entityRestriction. + # UW: type UW-Occurrence and substructure of req sentence + ?uw1 rdf:type unl:UW_Occurrence. + ?uw1 unl:is_substructure_of ?req. + # ------ ?uw1 unl:is_occurrence_of ?lexTrg. + # Label(s) / URI + ?uw1 rdfs:label ?uw1Label. + cprm:Config_Parameters cprm:netURI ?netURI + BIND (strbefore(?uw1Label, '(') AS ?concept1). + BIND (concat( ?netURI, ?entityClass, '_') AS ?s1). + BIND (concat(?s1, ?concept1) AS ?s2). + BIND (uri(?s2) AS ?semNet). + # Filter + FILTER ( regex(str(?uw1Label),str(?entityRestriction)) ). +}""" ; + sh:order "101"^^xsd:decimal ; +. +cts:dev_schemes + rdf:type owl:Class ; + rdf:type sh:NodeShape ; + rdfs:label "dev schemes" ; + rdfs:subClassOf cts:Transduction_Schemes ; +. +cts:entity_extraction + rdf:type owl:Class ; + rdf:type sh:NodeShape ; + rdfs:label "entity extraction" ; + rdfs:subClassOf cts:net_extension ; + sh:rule cts:compose-entity-modlist-1 ; + sh:rule cts:compose-entity-modlist-2 ; + sh:rule cts:create-entity-net ; + sh:rule cts:extend-mod-list ; + sh:rule cts:init-mod-list ; + sh:rule cts:typify-modlist-entity ; + sh:rule cts:typify-modlist-feature ; +. +cts:entity_extraction_1 + rdf:type cts:entity_extraction ; + rdfs:label "entity extraction 1" ; +. +cts:extend-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#> + +# -- Query to complement Entity classes in System Ontology +CONSTRUCT { + ?subEntityUri rdfs:subClassOf ?mainEntityUri. + ?subEntityUri rdfs:label ?subEntity. +} +WHERE { + # net1: entity class list + ?net1 a net:Instance. + ?net1 net:type net:entity_class_list. + ?net1 net:entityClass ?entityClass. + ?net1 net:class1 ?mainEntity. + ?net1 net:class2 ?subEntity. + # Label(s) / URI + cprm:Config_Parameters cprm:baseURI ?baseURI. + fprm:System_Ontology fprm:frameURI ?frameURI. + fprm:System_Entity rdfs:label ?entityLabel. + BIND (concat( ?frameURI, ?entityClass) AS ?s1). + BIND (concat(?s1, '_', ?mainEntity) AS ?s2). + BIND (concat(?s1, '_', ?subEntity) AS ?s3). + BIND (uri( ?s1) AS ?entityUri). + BIND (uri(?s2) AS ?mainEntityUri). + BIND (uri(?s3) AS ?subEntityUri). +}""" ; + sh:order "202"^^xsd:decimal ; +. +cts:extend-mod-list + 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#> + +# -- Query to extend a ModList net +CONSTRUCT { + ?semNet net:node ?uw2. + ?semNet net:concept ?concept1. + ?semNet net:concept ?concept2. +} +WHERE { + # UW: type UW-Occurrence and substructure of req sentence + ?uw1 rdf:type unl:UW_Occurrence. + ?uw2 rdf:type unl:UW_Occurrence. + ?uw1 unl:is_substructure_of ?req. + ?uw2 unl:is_substructure_of ?req. + # selection: modList net + ?semNet a net:Instance. + ?semNet net:type net:mod_list. + ?semNet net:node ?uw1. + # extension: disjunction of UW + ?uw1 (unl:or|unl:and) ?uw2. + # Label(s) / URI + ?uw1 rdfs:label ?uw1Label. + ?uw2 rdfs:label ?uw2Label. + BIND (strbefore(?uw1Label, '(') AS ?concept1) + BIND (strbefore(?uw2Label, '(') AS ?concept2) +}""" ; + sh:order "103"^^xsd:decimal ; +. +cts:generation + rdf:type owl:Class ; + rdf:type sh:NodeShape ; + rdfs:label "generation" ; + rdfs:subClassOf cts:Transduction_Schemes ; + sh:rule cts:add-disjunctive-entity-classes ; + sh:rule cts:add-entity-classes ; + sh:rule cts:extend-entity-classes ; +. +cts:generation_1 + rdf:type cts:generation ; + rdfs:label "generation 1" ; +. +cts:init-mod-list + 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#> + +# -- Query to initialize a ModList net +CONSTRUCT { + ?semNet a net:Instance. + ?semNet net:type net:mod_list. + ?semNet net:node ?uw1. +} +WHERE { + # UW: type UW-Occurrence and substructure of req sentence + ?uwSource rdf:type unl:UW_Occurrence. + ?uw1 rdf:type unl:UW_Occurrence. + ?uwSource unl:is_substructure_of ?req. + ?uw1 unl:is_substructure_of ?req. + # selection: target UW of modifier (mod) + ?uwSource unl:mod ?uw1. + # Label(s) / URI + ?uw1 rdfs:label ?uw1Label. + cprm:Config_Parameters cprm:netURI ?netURI. + net:mod_list rdfs:label ?modListLabel. + BIND (strbefore(?uw1Label, '(') AS ?concept1). + BIND (strbefore(?uw2Label, '(') AS ?concept2). + BIND (concat( ?netURI, ?modListLabel, '_') AS ?s1). + BIND (concat(?s1, ?concept1) AS ?s2). + BIND (uri(?s2) AS ?semNet). +}""" ; + sh:order "102"^^xsd:decimal ; +. +cts:link-to-scope-entry + 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#> + +# -- Request to extend UNL relation to scopes +# (by connecting the source node of the scope to the entry node of the scope) +CONSTRUCT { + ?node1Occ ?unlRel ?node2Occ. +} +WHERE { + ?scope rdf:type unl:UNL_Scope. + ?node1Occ unl:is_source_of ?rel. + ?rel unl:has_target ?scope. + ?scope unl:is_scope_of ?scopeRel. + ?scopeRel unl:has_source ?node2Occ. + ?node2Occ unl:has_attribute \".@entry\". + ?rel a ?unlRel. +} """ ; + sh:order "002"^^xsd:decimal ; +. +cts:net_extension + rdf:type owl:Class ; + rdf:type sh:NodeShape ; + rdfs:label "net extension" ; + rdfs:subClassOf cts:Transduction_Schemes ; +. +cts:preprocessing + rdf:type owl:Class ; + rdf:type sh:NodeShape ; + rdfs:label "preprocessing" ; + rdfs:subClassOf cts:Transduction_Schemes ; + sh:rule cts:bypass-reification ; + sh:rule cts:link-to-scope-entry ; +. +cts:preprocessing_1 + rdf:type cts:preprocessing ; + rdfs:label "preprocessing 1" ; +. +cts:typify-modlist-entity + 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#> + +# -- Typify a ModList net as Entity ModList +CONSTRUCT { + ?semNet net:type net:entity_mod_list. + ?semNet net:entityClass ?entityClass. +} +WHERE { + # Entity (from System Ontology) + ?entity rdf:type fprm:System_Entity. + ?entity fprm:class ?entityClass. + ?entity fprm:restriction ?entityRestriction. + # UW: type UW-Occurrence and substructure of req sentence + ?uw1 rdf:type unl:UW_Occurrence. + ?uw1 unl:is_substructure_of ?req. + # net: modList + ?semNet a net:Instance. + ?semNet net:type net:mod_list. + ?semNet net:node ?uw1. + # Label(s) / URI + ?uw1 rdfs:label ?uw1Label. + # Filter + FILTER ( regex(str(?uw1Label),str(?entityRestriction)) ). +}""" ; + sh:order "104"^^xsd:decimal ; +. +cts:typify-modlist-feature + 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#> + +# -- Typify a ModList net as Feature ModList +CONSTRUCT { + ?semNet net:type net:complement_mod_list. + ?semNet net:featureClass ?featureClass. +} +WHERE { + # Entity Feature (from System Ontology) + ?entity rdf:type fprm:System_Feature. + ?entity fprm:class ?featureClass. + ?entity fprm:restriction ?featureRestriction. + # UW: type UW-Occurrence and substructure of req sentence + ?uw1 rdf:type unl:UW_Occurrence. + ?uw1 unl:is_substructure_of ?req. + # net: modList + ?semNet a net:Instance. + ?semNet net:type net:mod_list. + ?semNet net:node ?uw1. + # Label(s) / URI + ?uw1 rdfs:label ?uw1Label. + # Filter + FILTER ( regex(str(?uw1Label),str(?featureRestriction)) ). +}""" ; + sh:order "105"^^xsd:decimal ; +.