Skip to content
Snippets Groups Projects
Commit da26b1e1 authored by Aurélien Lamercerie's avatar Aurélien Lamercerie
Browse files

Add entityIntance in CTS

parent 0e6aeed5
Branches
Tags
No related merge requests found
......@@ -70,6 +70,11 @@ net:entityClass
rdfs:label "entity class" ;
rdfs:subPropertyOf net:value ;
.
net:entityInstance
rdf:type rdf:Property ;
rdfs:label "entity instance" ;
rdfs:subPropertyOf net:value ;
.
net:entity_class_list
rdf:type owl:Class ;
rdfs:label "entityClassList" ;
......
......@@ -24,6 +24,67 @@ cts:Transduction_Schemes
rdfs:label "Transduction Schemes" ;
rdfs:subClassOf owl:Thing ;
.
cts:add-conjunctive-entity-classes
rdf:type sh:SPARQLRule ;
rdfs:label "add-conjunctive-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:intersectionOf ( ?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.
?net1 net:class2 ?subEntity2.
?net1 net:class2 ?subEntity3.
# extension: disjunction of UW
?uw2 unl:and ?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)
FILTER ( STRSTARTS(?subEntity2, ?concept2) ).
FILTER ( STRSTARTS(?subEntity3, ?concept3) ).
# -- old --- BIND (concat(?concept2, '_', ?mainEntity) AS ?subEntity2).
# -- old --- 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).
# --old --- FILTER NOT EXISTS { ?net2 net:class2 ?mainEntity }.
# --old --- FILTER NOT EXISTS { ?subEntity23Uri owl:equivalentClass ?c }.
}""" ;
sh:order "204"^^xsd:decimal ;
.
cts:add-disjunctive-entity-classes
rdf:type sh:SPARQLRule ;
rdfs:label "add-disjunctive-entity-classes" ;
......@@ -315,7 +376,7 @@ WHERE {
BIND (concat(?s1, ?mainEntity, '-', ?concept2) AS ?s2).
BIND (uri(?s2) AS ?newNet).
}""" ;
sh:order "106"^^xsd:decimal ;
sh:order "121"^^xsd:decimal ;
.
cts:compose-entity-modlist-2
rdf:type sh:SPARQLRule ;
......@@ -384,7 +445,7 @@ WHERE {
BIND (concat(?s1, ?mainEntity, '-', ?subEntity2) AS ?s2).
BIND (uri(?s2) AS ?newNet).
}""" ;
sh:order "107"^^xsd:decimal ;
sh:order "122"^^xsd:decimal ;
.
cts:compose-entity-modlist-3
rdf:type sh:SPARQLRule ;
......@@ -450,7 +511,7 @@ WHERE {
BIND (concat(?s1, ?mainEntity, '-', ?subEntity2) AS ?s2).
BIND (uri(?s2) AS ?newNet).
}""" ;
sh:order "108"^^xsd:decimal ;
sh:order "123"^^xsd:decimal ;
.
cts:create-entity-net
rdf:type sh:SPARQLRule ;
......@@ -513,6 +574,7 @@ cts:entity_extraction
sh:rule cts:create-entity-net ;
sh:rule cts:extend-mod-list ;
sh:rule cts:init-mod-list ;
sh:rule cts:instantiate-entity-net ;
sh:rule cts:typify-modlist-entity ;
sh:rule cts:typify-modlist-feature ;
.
......@@ -593,9 +655,9 @@ WHERE {
# extension: disjunction of UW
?uw1 (unl:or|unl:and) ?uw2.
# UW: type UW-Occurrence and substructure of req sentence
?uw1 rdf:type unl:UW_Occurrence.
# -- old --- ?uw1 rdf:type unl:UW_Occurrence.
# -- old --- ?uw1 unl:is_substructure_of ?req.
?uw2 rdf:type unl:UW_Occurrence.
?uw1 unl:is_substructure_of ?req.
?uw2 unl:is_substructure_of ?req.
# Label(s) / URI
?uw1 rdfs:label ?uw1Label.
......@@ -603,15 +665,15 @@ WHERE {
BIND (strbefore(?uw1Label, '(') AS ?concept1)
BIND (strbefore(?uw2Label, '(') AS ?concept2)
}""" ;
sh:order "103"^^xsd:decimal ;
sh:order "112"^^xsd:decimal ;
.
cts:generation
rdf:type owl:Class ;
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-disjunctive-entity-classes-2--old ;
sh:rule cts:add-entity-classes ;
sh:rule cts:add-list-of-entity-classes ;
.
......@@ -656,6 +718,44 @@ WHERE {
BIND (concat( ?netURI, ?modListLabel, '_') AS ?s1).
BIND (concat(?s1, ?concept1) AS ?s2).
BIND (uri(?s2) AS ?semNet).
}""" ;
sh:order "111"^^xsd:decimal ;
.
cts:instantiate-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#>
# -- Create Entity net
CONSTRUCT {
?net1 net:entityInstance ?instanceName.
}
WHERE {
# net1: entity
?net1 a net:Instance.
?net1 net:type net:entity.
?net1 net:node ?uw1.
?net1 net:entityClass ?entityClass1.
?net1 net:concept ?concept1.
# condition: agt/obj(uw0, uw1)
?uw0 (unl:agt | unl:obj) ?uw1.
# UW: type UW-Occurrence and substructure of req sentence
?uw0 rdf:type unl:UW_Occurrence.
?uw0 unl:is_substructure_of ?req.
# -- old ---- ?uw1 rdf:type unl:UW_Occurrence.
# -- old ---- ?uw1 unl:is_substructure_of ?req.
# -- old ---- ?uw1 unl:is_occurrence_of ?lexTrg.
# Label(s) / URI
BIND (concat( ?entityClass1, '_', ?concept1) AS ?s1).
BIND (concat(?s1, '_instance') AS ?instanceName).
}""" ;
sh:order "102"^^xsd:decimal ;
.
......@@ -764,7 +864,7 @@ WHERE {
# Filter
FILTER ( regex(str(?uw1Label),str(?entityRestriction)) ).
}""" ;
sh:order "104"^^xsd:decimal ;
sh:order "113"^^xsd:decimal ;
.
cts:typify-modlist-feature
rdf:type sh:SPARQLRule ;
......@@ -802,5 +902,5 @@ WHERE {
# Filter
FILTER ( regex(str(?uw1Label),str(?featureRestriction)) ).
}""" ;
sh:order "105"^^xsd:decimal ;
sh:order "114"^^xsd:decimal ;
.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment