Legalo
From STLab
(Difference between revisions)
(→Path identification algorithm) |
(→Path identification algorithm) |
||
Line 1: | Line 1: | ||
== Legalo == | == Legalo == | ||
- | === | + | |
+ | |||
+ | === Subgraphs identification algorithm (implemented by the Semantic Web property extractor) === | ||
'''algorithm''' legalo '''is''' | '''algorithm''' legalo '''is''' | ||
- | '''input''' | + | '''input''' ''G'': a RDF graph from FRED''' |
- | '''output''' | + | '''output''' ''S'': a set of RDF triples expressing semantic relations between named entities recognized in ''G'' |
let ''E'' the set of named entities in ''G'' | let ''E'' the set of named entities in ''G'' | ||
- | let ''C'' | + | let ''C'' the set of all named entity pairs combinations including permutations |
'''for each''' named entity ''e<sub>1</sub>'' '''in''' ''E'' | '''for each''' named entity ''e<sub>1</sub>'' '''in''' ''E'' | ||
Line 16: | Line 18: | ||
let ''P'' a set of tuples <''e1, e2, sub-graph''> | let ''P'' a set of tuples <''e1, e2, sub-graph''> | ||
+ | let DFS stand for ''depth first search'' | ||
'''for each''' pair <''e<sub>1</sub>, e<sub>2</sub>''> '''in''' ''C'' | '''for each''' pair <''e<sub>1</sub>, e<sub>2</sub>''> '''in''' ''C'' | ||
- | ''directPaths'' ← | + | ''directPaths'' ← DFS in ''G'' retrieving all direct paths between ''e<sub>1</sub>'' and ''e<sub>2</sub>'' |
'''if''' ''directPaths'' is not empty | '''if''' ''directPaths'' is not empty | ||
'''for each''' ''directPath'' '''in''' ''directPaths'' | '''for each''' ''directPath'' '''in''' ''directPaths'' | ||
add ''<e1, e2, directPath>'' to ''P'' | add ''<e1, e2, directPath>'' to ''P'' | ||
'''else''' | '''else''' | ||
- | '''for each''' | + | '''for each''' node of type dul:Event ''event'' '''in''' ''G'' |
- | ''leftSubGraph'' ← | + | ''leftSubGraph'' ← DFS in ''G'' for retrieving the shortest direct paths connecting ''e<sub>1</sub>'' and ''event'' |
- | ''rightSubGraph'' ← | + | ''rightSubGraph'' ← DFS in ''G'' for finding the shortest direct paths connecting ''event'' and ''e<sub>2</sub>'' |
'''if''' ''rightSubGraph'' does not contain agentive roles | '''if''' ''rightSubGraph'' does not contain agentive roles | ||
add ''<e1, e2, rightSubGraph>'' to ''P'' | add ''<e1, e2, rightSubGraph>'' to ''P'' | ||
Line 32: | Line 35: | ||
'''for each''' tuple <''e1, e2, sub-graph''> in ''P'' | '''for each''' tuple <''e1, e2, sub-graph''> in ''P'' | ||
- | ''property'' ← | + | ''property'' ← produce semantic web relation based on ''p'' |
add RDF triple ''e1'' - ''property'' - ''e2'' to ''S'' | add RDF triple ''e1'' - ''property'' - ''e2'' to ''S'' | ||
Revision as of 22:44, 13 June 2014
Legalo
Subgraphs identification algorithm (implemented by the Semantic Web property extractor)
algorithm legalo is input G: a RDF graph from FRED output S: a set of RDF triples expressing semantic relations between named entities recognized in G let E the set of named entities in G let C the set of all named entity pairs combinations including permutations for each named entity e1 in E for each named entity e2 in E if e1 != e2' add <e1, e2'> to C let P a set of tuples <e1, e2, sub-graph> let DFS stand for depth first search for each pair <e1, e2> in C directPaths ← DFS in G retrieving all direct paths between e1 and e2 if directPaths is not empty for each directPath in directPaths add <e1, e2, directPath> to P else for each node of type dul:Event event in G leftSubGraph ← DFS in G for retrieving the shortest direct paths connecting e1 and event rightSubGraph ← DFS in G for finding the shortest direct paths connecting event and e2 if rightSubGraph does not contain agentive roles add <e1, e2, rightSubGraph> to P let S a set of RDF triples for each tuple <e1, e2, sub-graph> in P property ← produce semantic web relation based on p add RDF triple e1 - property - e2 to S
Generating semantic relations
In order to generate a semantic relation from each sub-graph identified with the legalo algorithm, the following criteria are taken into account:
- a label of a semantic relation is generated by concatenating the properties found in the statements from an event to an object
- some mappings between properties and terms of a semantic relation are performed according to the following criteria
- vnrole:Beneficiary → for
- vnrole:Instrument → with
- vnrole:Destination → to
- vnrole:Topic → about
- while traversing the statements, also the types of subject nodes are taken into account. Namely, given a subject node its most general FRED type is added into the label of a semantic relation
- repetitions of terms into a label of a semantic relation are avoided, i.e. in case of consecutive properties in a sub-graph such as born born only one is used into a semantic relation