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

New relation for possible range/domain in Event/StateProperty Net

parent baded25f
Branches
Tags
No related merge requests found
......@@ -135,6 +135,16 @@ net:has_object
rdfs:label "relation" ;
rdfs:subPropertyOf net:property ;
.
net:has_possible_domain
rdf:type rdf:Property ;
rdfs:label "has possible domain" ;
rdfs:subPropertyOf net:has_object ;
.
net:has_possible_range
rdf:type rdf:Property ;
rdfs:label "has possible range" ;
rdfs:subPropertyOf net:has_object ;
.
net:has_structure
rdf:type rdf:Property ;
rdfs:label "Linguistic Structure (in UNL Document)" ;
......
......@@ -299,10 +299,10 @@ CONSTRUCT {
?newEventObjectPropertyUri a owl:ObjectProperty.
?newEventObjectPropertyUri rdfs:subPropertyOf ?eventObjectPropertyUri.
?newEventObjectPropertyUri rdfs:label ?verbConcept.
?newEventObjectPropertyUri rdfs:domain ?actorClassUri.
?newEventObjectPropertyUri rdfs:range ?targetClassUri.
# -- old --- ?newEventObjectPropertyUri rdfs:domain ?actorUri.
# -- old --- ?newEventObjectPropertyUri rdfs:range ?targetUri.
?newEventObjectPropertyUri sys:from_structure ?req.
?actorUri ?newEventObjectPropertyUri ?targetUri.
?actorInstanceUri ?newEventObjectPropertyUri ?targetInstanceUri.
}
WHERE {
# net1: entity
......@@ -315,9 +315,11 @@ WHERE {
?net1 net:has_actor ?actorObject1.
?actorObject1 net:entityClass ?actorClass.
?actorObject1 net:concept ?actorConcept.
?actorObject1 net:entityInstance ?actorInstance.
?net1 net:has_target ?targetObject1.
?targetObject1 net:entityClass ?targetClass.
?targetObject1 net:concept ?targetConcept.
?targetObject1 net:entityInstance ?targetInstance.
# Label: event
BIND (concat(?actorConcept, '-', ?verbConcept) AS ?e1).
BIND (concat(?e1, '-', ?targetConcept) AS ?eventLabel).
......@@ -342,12 +344,16 @@ WHERE {
fprm:System_Ontology fprm:frameURI ?frameURI.
BIND (concat( ?frameURI, ?actorClass) AS ?e1a).
BIND (concat(?e1a, '#', ?actorConcept) AS ?e1b).
BIND (concat(?e1a, '_', ?actorInstance) AS ?e1c).
BIND (uri(?e1a) AS ?actorClassUri).
BIND (uri(?e1b) AS ?actorUri).
BIND (uri(?e1c) AS ?actorInstanceUri).
BIND (concat( ?frameURI, ?targetClass) AS ?e2a).
BIND (concat(?e2a, '#', ?targetConcept) AS ?e2b).
BIND (concat(?e2a, '_', ?targetInstance) AS ?e2c).
BIND (uri(?e2a) AS ?targetClassUri).
BIND (uri(?e2b) AS ?targetUri).
BIND (uri(?e2c) AS ?targetInstanceUri).
}""" ;
sh:order 3.1 ;
.
......@@ -474,10 +480,10 @@ CONSTRUCT {
?newStatePropertyObjectPropertyUri a owl:ObjectProperty.
?newStatePropertyObjectPropertyUri rdfs:subPropertyOf ?statePropertyObjectPropertyUri.
?newStatePropertyObjectPropertyUri rdfs:label ?verbConcept.
?newStatePropertyObjectPropertyUri rdfs:domain ?actorClassUri.
?newStatePropertyObjectPropertyUri rdfs:range ?targetClassUri.
# -- old --- ?newStatePropertyObjectPropertyUri rdfs:domain ?actorUri.
# -- old --- ?newStatePropertyObjectPropertyUri rdfs:range ?targetUri.
?newStatePropertyObjectPropertyUri sys:from_structure ?req.
?actorUri ?statePropertyObjectPropertyUri ?targetUri.
?actorInstanceUri ?newStatePropertyObjectPropertyUri ?targetInstanceUri.
}
WHERE {
# net1: entity
......@@ -490,9 +496,11 @@ WHERE {
?net1 net:has_actor ?actorObject1.
?actorObject1 net:entityClass ?actorClass.
?actorObject1 net:concept ?actorConcept.
?actorObject1 net:entityInstance ?actorInstance.
?net1 net:has_target ?targetObject1.
?targetObject1 net:entityClass ?targetClass.
?targetObject1 net:concept ?targetConcept.
?targetObject1 net:entityInstance ?targetInstance.
# Label: event
BIND (concat(?actorConcept, '-', ?verbConcept) AS ?e1).
BIND (concat(?e1, '-', ?targetConcept) AS ?statePropertyLabel).
......@@ -510,19 +518,23 @@ WHERE {
# URI (for object property)
fprm:System_State_Property fprm:objectProperty ?statePropertyObjectProperty.
BIND (concat( ?frameURI, ?statePropertyObjectProperty) AS ?o1).
BIND (concat(?o1, '_', ?verbConcept) AS ?o2).
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 (concat(?e1a, '_', ?actorInstance) AS ?e1c).
BIND (uri(?e1a) AS ?actorClassUri).
BIND (uri(?e1b) AS ?actorUri).
BIND (uri(?e1c) AS ?actorInstanceUri).
BIND (concat( ?frameURI, ?targetClass) AS ?e2a).
BIND (concat(?e2a, '_', ?targetConcept) AS ?e2b).
BIND (concat(?e2a, '#', ?targetConcept) AS ?e2b).
BIND (concat(?e2a, '_', ?targetInstance) AS ?e2c).
BIND (uri(?e2a) AS ?targetClassUri).
BIND (uri(?e2b) AS ?targetUri).
BIND (uri(?e2c) AS ?targetInstanceUri).
}""" ;
sh:order 3.1 ;
.
......@@ -708,6 +720,8 @@ CONSTRUCT {
?newNet net:has_actor ?actorObject.
?newNet net:has_verb ?verbObject.
?newNet net:has_target ?targetObject.
?newNet net:has_possible_domain ?domainClass.
?newNet net:has_possible_range ?rangeClass.
}
WHERE {
# net1: verb
......@@ -735,6 +749,13 @@ WHERE {
?uw1 unl:has_id ?uw1Id.
?uw2 unl:has_id ?uw2Id.
?uw3 unl:has_id ?uw3Id.
# Possible domain/range
?actorObject net:entityInstance ?actorObjectInstance.
?allActorObject net:entityInstance ?actorObjectInstance.
?allActorObject net:concept ?domainClass.
?targetObject net:entityInstance ?targetObjectInstance.
?allTargetObject net:entityInstance ?targetObjectInstance.
?allTargetObject net:concept ?rangeClass.
# URI (for Event Net)
cprm:Config_Parameters cprm:netURI ?netURI.
net:event rdfs:label ?eventLabel.
......@@ -767,6 +788,8 @@ CONSTRUCT {
?newNet net:has_actor ?actorObject.
?newNet net:has_verb ?verbObject.
?newNet net:has_target ?targetObject.
?newNet net:has_possible_domain ?domainClass.
?newNet net:has_possible_range ?rangeClass.
}
WHERE {
# net1: verb
......@@ -794,10 +817,17 @@ WHERE {
?uw1 unl:has_id ?uw1Id.
?uw2 unl:has_id ?uw2Id.
?uw3 unl:has_id ?uw3Id.
# URI (for Event Net)
# Possible domain/range
?actorObject net:entityInstance ?actorObjectInstance.
?allActorObject net:entityInstance ?actorObjectInstance.
?allActorObject net:concept ?domainClass.
?targetObject net:entityInstance ?targetObjectInstance.
?allTargetObject net:entityInstance ?targetObjectInstance.
?allTargetObject net:concept ?rangeClass.
# URI (for State Property Net)
cprm:Config_Parameters cprm:netURI ?netURI.
net:event rdfs:label ?eventLabel.
BIND (concat( ?netURI, ?eventLabel, '_') AS ?n1).
net:state_property rdfs:label ?statePropertyLabel.
BIND (concat( ?netURI, ?statePropertyLabel, '_') AS ?n1).
BIND (concat(?n1, ?uw1Id, '-', ?uw2Id, '-', ?uw3Id) AS ?n2).
BIND (uri(?n2) AS ?newNet).
}""" ;
......
......@@ -12,7 +12,7 @@
#==============================================================================
import glob
from rdflib import Graph
from rdflib import Graph, Namespace, URIRef
#==============================================================================
......@@ -92,6 +92,19 @@ def load_frame(work_graph):
print("----- Ontology Parameters (" + str(len(work_graph)) + ")")
#def define_namespace(work_graph):
# print("-- Namespace Definition:")
#
# sys_uri = "https://unsel.tetras-libre.fr/tenet/frame/system-ontology/"
# concept_classes = ["agent"]
# for concept in concept_classes:
# new_prefix = "sys-" + concept
# new_uri = URIRef(sys_uri + concept + '#')
# work_graph.namespace_manager.bind(new_prefix, new_uri)
# print("----- " + new_prefix + ": " + new_uri)
# print(list(work_graph.namespace_manager.namespaces()))
def load_sentences(work_graph, corpus):
print("-- Sentence Loading:")
......@@ -140,6 +153,7 @@ def run(corpus, output_ref, output_file):
work_graph = Graph()
load_config(work_graph)
load_frame(work_graph)
#define_namespace(work_graph)
print("\n" + "- Preparation of Transduction Process")
load_cts(work_graph)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment