From 104fd71819dfcbc338f2b85ff42483034a0c7ed2 Mon Sep 17 00:00:00 2001 From: David Rouquet <david.rouquet@tetras-libre.fr> Date: Wed, 25 Aug 2021 17:30:20 +0200 Subject: [PATCH] test shacl to store and organize rules --- extraction-rules.shapes.ttl | 582 ++++++++++++++++++++++++++++++++++++ 1 file changed, 582 insertions(+) create mode 100644 extraction-rules.shapes.ttl diff --git a/extraction-rules.shapes.ttl b/extraction-rules.shapes.ttl new file mode 100644 index 00000000..7be7aecd --- /dev/null +++ b/extraction-rules.shapes.ttl @@ -0,0 +1,582 @@ +# baseURI: http://unsel.unl-rdf.org/extraction-rules +# imports: http://datashapes.org/dash +# imports: http://unsel.rdf-unl.org/store/CCTP-SRSA-IP-20210625/SRSA-IP_STB_PHON_00300/current/sentence_0#ontology +# 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 : <http://unsel.unl-rdf.org/extraction-rules#> . +@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 schema: <https://unl.tetras-libre.fr/rdf/schema#> . +@prefix sentence_0: <http://unsel.rdf-unl.org/store/CCTP-SRSA-IP-20210625/SRSA-IP_STB_PHON_00300/current/sentence_0#> . +@prefix sh: <http://www.w3.org/ns/shacl#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . + +<http://unsel.unl-rdf.org/extraction-rules> + rdf:type owl:Ontology ; + owl:imports <http://datashapes.org/dash> ; + owl:imports sentence_0:ontology ; + 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> ; + owl:versionInfo "Created with TopBraid Composer" ; +. +<http://unsel.unl-rdf.org/extraction-rules#301> + 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 "301"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#302> + 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 "302"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#303> + 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. +} +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 "303"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#304> + 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 typify a ModList net as entity +CONSTRUCT { + ?semNet net:type net:entity_mod_list. + ?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. + # net: modList + ?semNet a net:Instance. + ?semNet net:type net:mod_list. + ?semNet net:node ?uw1. + # Label(s) / URI + ?uw1 rdfs:label ?uw1Label. + BIND (strbefore(?uw1Label, '(') AS ?concept1) + # Filter + FILTER ( regex(str(?uw1Label),str(?entityRestriction)) ). +} + +""" ; + sh:order "304"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#305> + 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 typify a ModList net as complement +CONSTRUCT { + ?semNet net:type net:complement_mod_list. + ?semNet net:featureClass ?featureClass. + ?semNet net:concept ?concept1. +} +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. + BIND (strbefore(?uw1Label, '(') AS ?concept1) + # Filter + FILTER ( regex(str(?uw1Label),str(?featureRestriction)) ). +} + +""" ; + sh:order "305"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#306> + 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 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 ?subEntity. +} +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. + # 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 + cprm:Config_Parameters cprm:netURI ?netURI. + net:class_list rdfs:label ?classListLabel. + BIND (concat(?subComplement, '-', ?mainEntity) AS ?subEntity). + BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). + BIND (concat(?s1, ?mainEntity, '-', ?featureClass) AS ?s2). + BIND (uri(?s2) AS ?newNet). +} + +""" ; + sh:order "306"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#307> + 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 compose an Entity net and an Entity ModList net (with same entity classes) +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 ?subEntity. +} +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. + # 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. + ?net2 net:concept ?subEntity. + # condition: mod(net1, net2) + ?uw1 unl:mod ?uw2. + # Label(s) / URI + ?uw2 rdfs:label ?uw2Label. + cprm:Config_Parameters cprm:netURI ?netURI. + net:class_list rdfs:label ?classListLabel. + BIND (strbefore(?uw2Label, '(') AS ?uw2Concept). + BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). + BIND (concat(?s1, ?mainEntity, '-', ?uw2Concept) AS ?s2). + BIND (uri(?s2) AS ?newNet). + # Filter: same entity classes + FILTER ( ?entityClass1 = ?entityClass2 ) +} + +""" ; + sh:order "307"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#308> + 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 compose an Entity net and an Entity ModList net (with distinct entity classes) +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 ?subEntity. +} +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. + # 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. + ?net2 net:concept ?subEntity. + # condition: mod(net1, net2) + ?uw1 unl:mod ?uw2. + # Label(s) / URI + ?uw2 rdfs:label ?uw2Label. + cprm:Config_Parameters cprm:netURI ?netURI. + net:class_list rdfs:label ?classListLabel. + BIND (strbefore(?uw2Label, '(') AS ?uw2Concept). + BIND (concat( ?netURI, ?classListLabel, '_') AS ?s1). + BIND (concat(?s1, ?mainEntity, '-', ?uw2Concept) AS ?s2). + BIND (uri(?s2) AS ?newNet). + # Filter: distinct entity classes + FILTER ( ?entityClass1 != ?entityClass2 ) +} + +""" ; + sh:order "308"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#401> + 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 "401"^^xsd:decimal ; +. +<http://unsel.unl-rdf.org/extraction-rules#402> + 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 "402"^^xsd:decimal ; +. +: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 "0"^^xsd:decimal ; +. +:extraction_rules + rdf:type owl:Class ; + rdfs:subClassOf owl:Thing ; +. +:generation + rdf:type rdfs:Class ; + rdfs:subClassOf sh:SPARQLRule ; +. +: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 "0"^^xsd:decimal ; +. +:net_extension + rdf:type rdfs:Class ; + rdfs:subClassOf sh:SPARQLRule ; +. +:preprocessing + rdf:type rdfs:Class ; + rdfs:subClassOf :extraction_rules ; +. +sh:SPARQLRule + rdfs:subClassOf owl:Thing ; +. +schema:UNL_Sentence + rdf:type sh:NodeShape ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#301> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#302> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#303> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#304> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#305> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#306> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#307> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#308> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#401> ; + sh:rule <http://unsel.unl-rdf.org/extraction-rules#402> ; + sh:rule :bypass-reification ; + sh:rule :link-to-scope-entry ; +. -- GitLab