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

Extraction of state property as class and ObjectProperty

parent 79ae3bb4
No related branches found
No related tags found
No related merge requests found
...@@ -193,6 +193,11 @@ net:property ...@@ -193,6 +193,11 @@ net:property
rdf:type rdf:Property ; rdf:type rdf:Property ;
rdfs:label "netProperty" ; rdfs:label "netProperty" ;
. .
net:state_property
rdf:type owl:Class ;
rdfs:label "stateProperty" ;
rdfs:subClassOf net:Type ;
.
net:type net:type
rdf:type rdf:Property ; rdf:type rdf:Property ;
rdfs:label "type "@fr ; rdfs:label "type "@fr ;
......
...@@ -299,6 +299,7 @@ CONSTRUCT { ...@@ -299,6 +299,7 @@ CONSTRUCT {
?newEventObjectPropertyUri rdfs:subPropertyOf ?eventObjectPropertyUri. ?newEventObjectPropertyUri rdfs:subPropertyOf ?eventObjectPropertyUri.
?newEventObjectPropertyUri rdfs:domain ?actorClassUri. ?newEventObjectPropertyUri rdfs:domain ?actorClassUri.
?newEventObjectPropertyUri rdfs:range ?targetClassUri. ?newEventObjectPropertyUri rdfs:range ?targetClassUri.
?newEventObjectPropertyUri sys:from_structure ?req.
?actorUri ?newEventObjectPropertyUri ?targetUri. ?actorUri ?newEventObjectPropertyUri ?targetUri.
} }
WHERE { WHERE {
...@@ -443,6 +444,85 @@ WHERE { ...@@ -443,6 +444,85 @@ WHERE {
}""" ; }""" ;
sh:order 3.2 ; sh:order 3.2 ;
. .
cts:add-state-property
rdf:type sh:SPARQLRule ;
rdfs:label "add-event" ;
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 Verb class / instance in System Ontology
CONSTRUCT {
# Classification
?newStatePropertyUri rdfs:subClassOf ?statePropertyClassUri.
?newStatePropertyUri rdfs:label ?statePropertyLabel.
?newStatePropertyUri sys:from_structure ?req.
# Instantiation !!! TODO !!!
# -- old --- ?mainInstanceUri a ?newStatePropertyUri.
# -- old --- ?mainInstanceUri rdfs:label ?mainInstance.
# -- old --- ?mainInstanceUri sys:from_structure ?req.
# Object Property
?newStatePropertyObjectPropertyUri a owl:ObjectProperty.
?newStatePropertyObjectPropertyUri rdfs:subPropertyOf ?statePropertyObjectPropertyUri.
?newStatePropertyObjectPropertyUri rdfs:domain ?actorClassUri.
?newStatePropertyObjectPropertyUri rdfs:range ?targetClassUri.
?newStatePropertyObjectPropertyUri sys:from_structure ?req.
?actorUri ?statePropertyObjectPropertyUri ?targetUri.
}
WHERE {
# net1: entity
?net1 a net:Instance.
?net1 net:type net:state_property.
?net1 net:has_structure ?req.
?net1 net:has_verb ?verbObject1.
?verbObject1 net:verbClass ?verbClass.
?verbObject1 net:concept ?verbConcept.
?net1 net:has_actor ?actorObject1.
?actorObject1 net:entityClass ?actorClass.
?actorObject1 net:concept ?actorConcept.
?net1 net:has_target ?targetObject1.
?targetObject1 net:entityClass ?targetClass.
?targetObject1 net:concept ?targetConcept.
# Label: event
BIND (concat(?actorConcept, '-', ?verbConcept) AS ?e1).
BIND (concat(?e1, '-', ?targetConcept) AS ?statePropertyLabel).
# URI (for classes)
fprm:System_Ontology fprm:frameURI ?frameURI.
fprm:System_State_Property fprm:class ?statePropertyClass.
BIND (concat( ?frameURI, ?statePropertyClass) AS ?c1).
BIND (concat(?c1, '_', ?statePropertyLabel) AS ?c2).
BIND (uri( ?c1) AS ?statePropertyClassUri).
BIND (uri(?c2) AS ?newStatePropertyUri).
# 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 object property)
fprm:System_State_Property fprm:objectProperty ?statePropertyObjectProperty.
BIND (concat( ?frameURI, ?statePropertyObjectProperty) AS ?o1).
BIND (concat(?o1, '_', ?verbConcept) AS ?o2).
BIND (uri( ?o1) AS ?statePropertyObjectPropertyUri).
BIND (uri( ?o2) AS ?newStatePropertyObjectPropertyUri).
# URI (for Entity classes)
fprm:System_Ontology fprm:frameURI ?frameURI.
BIND (concat( ?frameURI, ?actorClass) AS ?e1a).
BIND (concat(?e1a, '_', ?actorConcept) AS ?e1b).
BIND (uri(?e1a) AS ?actorClassUri).
BIND (uri(?e1b) AS ?actorUri).
BIND (concat( ?frameURI, ?targetClass) AS ?e2a).
BIND (concat(?e2a, '_', ?targetConcept) AS ?e2b).
BIND (uri(?e2a) AS ?targetClassUri).
BIND (uri(?e2b) AS ?targetUri).
}""" ;
sh:order 3.1 ;
.
cts:add-verb cts:add-verb
rdf:type sh:SPARQLRule ; rdf:type sh:SPARQLRule ;
rdfs:label "add-verb" ; rdfs:label "add-verb" ;
...@@ -460,9 +540,9 @@ PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#> ...@@ -460,9 +540,9 @@ PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#>
# -- Add Verb class / instance in System Ontology # -- Add Verb class / instance in System Ontology
CONSTRUCT { CONSTRUCT {
# Classification # Classification
?mainVerbUri rdfs:subClassOf ?verbUri. ?verbUri rdfs:subClassOf ?verbClassUri.
?mainVerbUri rdfs:label ?mainEntity. ?verbUri rdfs:label ?verbConcept.
?mainVerbUri sys:from_structure ?req. ?verbUri sys:from_structure ?req.
# Instantiation !!! TODO !!! # Instantiation !!! TODO !!!
# -- old --- ?mainInstanceUri a ?mainVerbUri. # -- old --- ?mainInstanceUri a ?mainVerbUri.
# -- old --- ?mainInstanceUri rdfs:label ?mainInstance. # -- old --- ?mainInstanceUri rdfs:label ?mainInstance.
...@@ -475,19 +555,19 @@ WHERE { ...@@ -475,19 +555,19 @@ WHERE {
?net1 net:has_structure ?req. ?net1 net:has_structure ?req.
?net1 net:has_verb ?verbObject1. ?net1 net:has_verb ?verbObject1.
?verbObject1 net:verbClass ?verbClass. ?verbObject1 net:verbClass ?verbClass.
?verbObject1 net:concept ?mainVerb. ?verbObject1 net:concept ?verbConcept.
# -- old --- ?verbObject1 net:entityInstance ?mainInstance. # -- old --- ?verbObject1 net:entityInstance ?mainInstance.
# Filter: entity not present in a class list # Filter: entity not present in a class list
FILTER NOT EXISTS { ?net2 net:has_subClass ?mainVerb} FILTER NOT EXISTS { ?net2 net:has_subClass ?verbConcept}
# URI (for classes) # URI (for classes)
cprm:Config_Parameters cprm:baseURI ?baseURI. cprm:Config_Parameters cprm:baseURI ?baseURI.
fprm:System_Ontology fprm:frameURI ?frameURI. fprm:System_Ontology fprm:frameURI ?frameURI.
fprm:System_Event fprm:class ?eventURI. fprm:System_Event fprm:class ?eventURI.
# -- old --- fprm:System_Entity rdfs:label ?verbLabel. # -- old --- fprm:System_Entity rdfs:label ?verbLabel.
BIND (concat( ?frameURI, ?verbClass) AS ?s1). BIND (concat( ?frameURI, ?verbClass) AS ?s1).
BIND (concat(?s1, '_', ?mainVerb) AS ?s2). BIND (concat(?s1, '_', ?verbConcept) AS ?s2).
BIND (uri( ?s1) AS ?verbUri). BIND (uri( ?s1) AS ?verbClassUri).
BIND (uri(?s2) AS ?mainVerbUri). BIND (uri(?s2) AS ?verbUri).
# URI (for instance) # URI (for instance)
# -- old --- BIND (concat(?s1, '_', ?mainInstance) AS ?s3). # -- old --- BIND (concat(?s1, '_', ?mainInstance) AS ?s3).
# -- old --- BIND (uri(?s3) AS ?mainInstanceUri). # -- old --- BIND (uri(?s3) AS ?mainInstanceUri).
...@@ -506,10 +586,12 @@ cts:batch_execution ...@@ -506,10 +586,12 @@ cts:batch_execution
sh:rule cts:add-event ; sh:rule cts:add-event ;
sh:rule cts:add-feature ; sh:rule cts:add-feature ;
sh:rule cts:add-list-of-entity-classes ; sh:rule cts:add-list-of-entity-classes ;
sh:rule cts:add-state-property ;
sh:rule cts:add-verb ; sh:rule cts:add-verb ;
sh:rule cts:bypass-reification ; sh:rule cts:bypass-reification ;
sh:rule cts:complement-list-of-entity-classes ; sh:rule cts:complement-list-of-entity-classes ;
sh:rule cts:compose-agt-verb-obj-as-event ; sh:rule cts:compose-agt-verb-obj-as-simple-event ;
sh:rule cts:compose-aoj-verb-obj-as-simple-state-property ;
sh:rule cts:compose-entity-modlist-1 ; sh:rule cts:compose-entity-modlist-1 ;
sh:rule cts:compose-entity-modlist-2 ; sh:rule cts:compose-entity-modlist-2 ;
sh:rule cts:compose-entity-modlist-3 ; sh:rule cts:compose-entity-modlist-3 ;
...@@ -600,7 +682,7 @@ WHERE { ...@@ -600,7 +682,7 @@ WHERE {
}""" ; }""" ;
sh:order 3.3 ; sh:order 3.3 ;
. .
cts:compose-agt-verb-obj-as-event cts:compose-agt-verb-obj-as-simple-event
rdf:type sh:SPARQLRule ; rdf:type sh:SPARQLRule ;
sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#> sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
...@@ -615,7 +697,7 @@ PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#> ...@@ -615,7 +697,7 @@ PREFIX fprm: <https://unsel.tetras-libre.fr/tenet/frame/parameters#>
# -- Compose a subject Entity (agt), an action Verb and an object Entity (obj) to obtain an event # -- Compose a subject Entity (agt), an action Verb and an object Entity (obj) to obtain an event
CONSTRUCT { CONSTRUCT {
# Net: Entity ClassList # Net: Event
?newNet a net:Instance. ?newNet a net:Instance.
?newNet net:type net:event. ?newNet net:type net:event.
?newNet net:has_structure ?req. ?newNet net:has_structure ?req.
...@@ -659,6 +741,65 @@ WHERE { ...@@ -659,6 +741,65 @@ WHERE {
}""" ; }""" ;
sh:order 2.9 ; sh:order 2.9 ;
. .
cts:compose-aoj-verb-obj-as-simple-state-property
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 a subject Entity (aoj), an action Verb and an object Entity (obj) / result Entity (res) to obtain a state property
CONSTRUCT {
# Net: State Property
?newNet a net:Instance.
?newNet net:type net:state_property.
?newNet net:has_structure ?req.
?newNet net:has_node ?uw1, ?uw2, ?uw3.
?newNet net:has_actor ?actorObject.
?newNet net:has_verb ?verbObject.
?newNet net:has_target ?targetObject.
}
WHERE {
# net1: verb
?net1 a net:Instance.
?net1 net:type net:verb.
?net1 net:has_structure ?req.
?net1 net:has_node ?uw1.
?net1 net:has_verb ?verbObject.
# net2: entity (actor)
?net2 a net:Instance.
?net2 net:type net:entity.
?net2 net:has_structure ?req.
?net2 net:has_node ?uw2.
?net2 net:has_entity ?actorObject.
# net3: entity (target)
?net3 a net:Instance.
?net3 net:type net:entity.
?net3 net:has_structure ?req.
?net3 net:has_node ?uw3.
?net3 net:has_entity ?targetObject.
# condition: aoj(net1, net2) et obj(net1, net3)
?uw1 unl:aoj ?uw2.
?uw1 (unl:obj|unl:res) ?uw3.
# Label: Id
?uw1 unl:has_id ?uw1Id.
?uw2 unl:has_id ?uw2Id.
?uw3 unl:has_id ?uw3Id.
# URI (for Event Net)
cprm:Config_Parameters cprm:netURI ?netURI.
net:event rdfs:label ?eventLabel.
BIND (concat( ?netURI, ?eventLabel, '_') AS ?n1).
BIND (concat(?n1, ?uw1Id, '-', ?uw2Id, '-', ?uw3Id) AS ?n2).
BIND (uri(?n2) AS ?newNet).
}""" ;
sh:order 2.9 ;
.
cts:compose-entity-modlist-1 cts:compose-entity-modlist-1
rdf:type sh:SPARQLRule ; rdf:type sh:SPARQLRule ;
sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#> sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#>
...@@ -1229,9 +1370,9 @@ cts:entity_extraction ...@@ -1229,9 +1370,9 @@ cts:entity_extraction
cts:event_extraction cts:event_extraction
rdf:type owl:Class ; rdf:type owl:Class ;
rdf:type sh:NodeShape ; rdf:type sh:NodeShape ;
rdfs:label "property extraction" ; rdfs:label "event extraction" ;
rdfs:subClassOf cts:net_extension ; rdfs:subClassOf cts:net_extension ;
sh:rule cts:compose-agt-verb-obj-as-event ; sh:rule cts:compose-agt-verb-obj-as-simple-event ;
. .
cts:extend-mod-list cts:extend-mod-list
rdf:type sh:SPARQLRule ; rdf:type sh:SPARQLRule ;
...@@ -1290,6 +1431,7 @@ cts:generation ...@@ -1290,6 +1431,7 @@ cts:generation
sh:rule cts:add-event ; sh:rule cts:add-event ;
sh:rule cts:add-feature ; sh:rule cts:add-feature ;
sh:rule cts:add-list-of-entity-classes ; sh:rule cts:add-list-of-entity-classes ;
sh:rule cts:add-state-property ;
sh:rule cts:add-verb ; sh:rule cts:add-verb ;
sh:rule cts:complement-list-of-entity-classes ; sh:rule cts:complement-list-of-entity-classes ;
. .
...@@ -1440,7 +1582,7 @@ WHERE { ...@@ -1440,7 +1582,7 @@ WHERE {
?net1 net:has_node ?uw1. ?net1 net:has_node ?uw1.
?net1 net:has_entity ?entityObject1. ?net1 net:has_entity ?entityObject1.
# condition: agt/obj(uw0, uw1) # condition: agt/obj(uw0, uw1)
?uw0 (unl:agt | unl:obj) ?uw1. ?uw0 (unl:agt | unl:obj | unl:aoj) ?uw1.
# UW: type UW-Occurrence and substructure of req sentence # UW: type UW-Occurrence and substructure of req sentence
?uw0 rdf:type unl:UW_Occurrence. ?uw0 rdf:type unl:UW_Occurrence.
?uw0 unl:is_substructure_of ?req. ?uw0 unl:is_substructure_of ?req.
...@@ -1497,6 +1639,13 @@ cts:preprocessing ...@@ -1497,6 +1639,13 @@ cts:preprocessing
sh:rule cts:define-uw-id ; sh:rule cts:define-uw-id ;
sh:rule cts:link-to-scope-entry ; sh:rule cts:link-to-scope-entry ;
. .
cts:state_property_extraction
rdf:type owl:Class ;
rdf:type sh:NodeShape ;
rdfs:label "state property extraction" ;
rdfs:subClassOf cts:net_extension ;
sh:rule cts:compose-aoj-verb-obj-as-simple-state-property ;
.
cts:typify-modlist-entity cts:typify-modlist-entity
rdf:type sh:SPARQLRule ; rdf:type sh:SPARQLRule ;
sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#> sh:construct """PREFIX owl: <http://www.w3.org/2002/07/owl#>
......
...@@ -51,6 +51,14 @@ fprm:System_Ontology ...@@ -51,6 +51,14 @@ fprm:System_Ontology
rdfs:subClassOf fprm:Frame_Parameters ; rdfs:subClassOf fprm:Frame_Parameters ;
fprm:frameURI "https://unsel.tetras-libre.fr/tenet/frame/system-ontology#" ; fprm:frameURI "https://unsel.tetras-libre.fr/tenet/frame/system-ontology#" ;
. .
fprm:System_State_Property
rdf:type owl:Class ;
rdfs:comment "Parameters related to State Property (System Ontology)." ;
rdfs:label "state_property" ;
rdfs:subClassOf fprm:System_Ontology ;
fprm:class "State_Property" ;
fprm:objectProperty "statePropertyObjectProperty" ;
.
fprm:System_Verb fprm:System_Verb
rdf:type owl:Class ; rdf:type owl:Class ;
rdfs:comment "Parameters related to Verb (System Ontology)." ; rdfs:comment "Parameters related to Verb (System Ontology)." ;
...@@ -112,7 +120,7 @@ fprm:system_agent ...@@ -112,7 +120,7 @@ fprm:system_agent
fprm:system_attributive_verb fprm:system_attributive_verb
rdf:type fprm:System_Verb ; rdf:type fprm:System_Verb ;
rdfs:label "attributiveVerb" ; rdfs:label "attributiveVerb" ;
fprm:class "attrbutive_verb" ; fprm:class "attributive_verb" ;
fprm:restriction "icl>be" ; fprm:restriction "icl>be" ;
. .
fprm:system_component fprm:system_component
......
...@@ -137,6 +137,11 @@ sys:place ...@@ -137,6 +137,11 @@ sys:place
rdfs:label "place"@en ; rdfs:label "place"@en ;
rdfs:subClassOf sys:Feature ; rdfs:subClassOf sys:Feature ;
. .
sys:statePropertyObjectProperty
rdf:type rdf:Property ;
rdfs:label "state property object property" ;
rdfs:subPropertyOf sys:objectProperty ;
.
sys:verbClassProperty sys:verbClassProperty
rdf:type rdf:Property ; rdf:type rdf:Property ;
rdfs:label "verb property" ; rdfs:label "verb property" ;
......
...@@ -37,7 +37,7 @@ f_param_file = "ontology-parameters.ttl" ...@@ -37,7 +37,7 @@ f_param_file = "ontology-parameters.ttl"
# Dev Tests # Dev Tests
base_uri = "https://unsel.tetras-libre.fr/tenet/working" base_uri = "https://unsel.tetras-libre.fr/tenet/working"
req_110 = "CCTP-SRSA-IP-20210831-R110/" req_100 = "CCTP-SRSA-IP-20210831-R100/"
req_300 = "CCTP-SRSA-IP-20210831-R300/" req_300 = "CCTP-SRSA-IP-20210831-R300/"
corpus_40 = "CCTP-SRSA-IP-20210831/" corpus_40 = "CCTP-SRSA-IP-20210831/"
...@@ -162,7 +162,7 @@ def run(corpus, output_ref, output_file): ...@@ -162,7 +162,7 @@ def run(corpus, output_ref, output_file):
if __name__ == '__main__': if __name__ == '__main__':
run(req_300, 'R300', 'output300.ttl') run(req_300, 'R300', 'output300.ttl')
run(req_110, 'R110', 'output110.ttl') run(req_100, 'R100', 'output100.ttl')
run(corpus_40, 'CCTP-Corpus-40', 'output40.ttl') run(corpus_40, 'CCTP-Corpus-40', 'output40.ttl')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment