Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
tenet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tetras MARS
tenet
Commits
c8bd2a72
Commit
c8bd2a72
authored
3 years ago
by
Aurélien Lamercerie
Browse files
Options
Downloads
Patches
Plain Diff
New relation for possible range/domain in Event/StateProperty Net
parent
baded25f
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
config/semantic-net.ttl
+10
-0
10 additions, 0 deletions
config/semantic-net.ttl
config/transduction-schemes.ttl
+41
-11
41 additions, 11 deletions
config/transduction-schemes.ttl
prepare_work_data.py
+15
-1
15 additions, 1 deletion
prepare_work_data.py
with
66 additions
and
12 deletions
config/semantic-net.ttl
+
10
−
0
View file @
c8bd2a72
...
...
@@ -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)"
;
...
...
This diff is collapsed.
Click to expand it.
config/transduction-schemes.ttl
+
41
−
11
View file @
c8bd2a72
...
...
@@ -299,10 +299,10 @@ CONSTRUCT {
?newEventObjectPropertyUri a owl:ObjectProperty.
?newEventObjectPropertyUri rdfs:subPropertyOf ?eventObjectPropertyUri.
?newEventObjectPropertyUri rdfs:label ?verbConcept.
?newEventObjectPropertyUri rdfs:domain ?actor
Class
Uri.
?newEventObjectPropertyUri rdfs:range ?target
Class
Uri.
# -- old ---
?newEventObjectPropertyUri rdfs:domain ?actorUri.
# -- old ---
?newEventObjectPropertyUri rdfs:range ?targetUri.
?newEventObjectPropertyUri sys:from_structure ?req.
?actorUri ?newEventObjectPropertyUri ?targetUri.
?actor
Instance
Uri ?newEventObjectPropertyUri ?target
Instance
Uri.
}
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 ?actor
Class
Uri.
?newStatePropertyObjectPropertyUri rdfs:range ?target
Class
Uri.
# -- old ---
?newStatePropertyObjectPropertyUri rdfs:domain ?actorUri.
# -- old ---
?newStatePropertyObjectPropertyUri rdfs:range ?targetUri.
?newStatePropertyObjectPropertyUri sys:from_structure ?req.
?actorUri ?
s
tatePropertyObjectPropertyUri ?targetUri.
?actor
Instance
Uri ?
newS
tatePropertyObjectPropertyUri ?target
Instance
Uri.
}
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 ?event
Label.
BIND (concat( ?netURI, ?
event
Label, '_') AS ?n1).
net:
state_property rdfs:label ?stateProperty
Label.
BIND (concat( ?netURI, ?
stateProperty
Label, '_') AS ?n1).
BIND (concat(?n1, ?uw1Id, '-', ?uw2Id, '-', ?uw3Id) AS ?n2).
BIND (uri(?n2) AS ?newNet).
}"""
;
...
...
This diff is collapsed.
Click to expand it.
prepare_work_data.py
+
15
−
1
View file @
c8bd2a72
...
...
@@ -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
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment