Skip to content
Snippets Groups Projects
Commit d14b5ec3 authored by Sebastien's avatar Sebastien
Browse files

Merge branch '8-pb-d-attachement-des-relations-aux-scopes' into 'master'

Resolve "Pb d'attachement des relations aux scopes"

Closes #8

See merge request !5
parents 1fa1f3a4 7a2aafc5
No related branches found
No related tags found
1 merge request!5Resolve "Pb d'attachement des relations aux scopes"
[D]
[S:R2]
{org:en}
The system displays a channel in green when it is in broadcast state.
{/org}
{unl}
agt(display(icl>show,equ>exhibit,agt>thing,obj>thing).@entry.@present,system(icl>group).@def)
mod(channel(icl>radiowave).@indef,green(icl>adj,iof>color))
obj(display(icl>show,equ>exhibit,agt>thing,obj>thing).@entry.@present,channel(icl>radiowave).@indef)
tim(display(icl>show,equ>exhibit,agt>thing,obj>thing).@entry.@present,when(icl>how,com>always,tim<uw,obj>uw))
aoj:01(be_in_a_state(aoj>thing,icl>be,obj>state).@entry.@present,channel(icl>radiowave).@indef)
plc:01(state(icl>attribute),broadcast(icl>message))
obj:01(be_in_a_state(aoj>thing,icl>be,obj>state).@entry.@present,state(icl>attribute))
obj(when(icl>how,com>always,tim<uw,obj>uw),:01)
{/unl}
[/S]
[/D]
\ No newline at end of file
......@@ -77,7 +77,7 @@ public class UnlDocumentToRdfConverter {
var uw = (UniversalWordNode) sentenceNode;
// Création de l'universalWord dans le dictionnaire
var universalWordIndividual = sentenceOntModel.createIndividual(String.format("%s#%s", uniqId, slugify(uw.getUniversalWord().toString())), UNL.UW_Lexeme);
var universalWordIndividual = sentenceOntModel.createIndividual(String.format("%s/%s#%s", DOMAIN, uniqId, slugify(uw.getUniversalWord().toString())), UNL.UW_Lexeme);
universalWordIndividual.addLabel(uw.getUniversalWord().toString(), "fr/tetras_libre/unltools/unl");
// Création de l'occurence du l'universalWord
......@@ -92,9 +92,13 @@ public class UnlDocumentToRdfConverter {
sentenceOntModel.add(universalWordOccurrence, UNL.has_attribute, attribute);
}
for (var graphRefNode : sentencegraph.getNodes()) {
if (graphRefNode instanceof SubGraphReferenceNode) {
var scopeName = SubGraphReferenceNodeExtensions.getScopeNameFromSubGraphReferenceNode((SubGraphReferenceNode) graphRefNode);
sentencegraph
.getNodes()
.stream()
.filter(node -> node instanceof SubGraphReferenceNode)
.map(SubGraphReferenceNode.class::cast)
.forEach(graphRefNode -> {
var scopeName = SubGraphReferenceNodeExtensions.getScopeNameFromSubGraphReferenceNode(graphRefNode);
var scopeIndividual = sentenceOntModel.createIndividual(
UtilGraphNodeUri.constructGraphNodeUri(sentenceNameSpace, graphRefNode),
UNL.UNL_Scope);
......@@ -102,31 +106,19 @@ public class UnlDocumentToRdfConverter {
scopeIndividual.addLabel(scopeName, "fr/tetras_libre/unltools/unl");
this.setSuperstructureWithSubstructure(sentenceOntModel, sentenceIndividual, sentenceOntModel, scopeIndividual);
/*
GraphExtensions.getRelationWithinScopeStream(scopeName, sentencegraph)
GraphExtensions.getRelationWithinScopeStream(graphRefNode.getReferenceNumber(), sentencegraph)
.forEach(relationWithinScope -> {
try {
var relationWithinScopeUri = RelationsUri.constructRelationUri(scopeName, relationWithinScope);
var relationWithinScopeUri = RelationsUri.constructRelationUri(String.format("%s#", sentenceUri), relationWithinScope);
var relationWithinScopeObjectProperty = this.relationLabelToUnlPropertyConverter.getObjectProperty(relationWithinScope.getRelationLabel(), docModel);
sentenceOntModel.createIndividual(relationWithinScopeUri, relationWithinScopeObjectProperty);
var relationWithinScopeIndividual = sentenceOntModel.createIndividual(relationWithinScopeUri, relationWithinScopeObjectProperty);
sentenceOntModel.add(scopeIndividual, UNL.is_scope_of, relationWithinScopeIndividual);
sentenceOntModel.add(relationWithinScopeIndividual, UNL.has_scope, scopeIndividual);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
});
*/
var relationsWithinScope = GraphExtensions.getRelationsWithinScope(scopeName, sentencegraph);
for (var relationWithinScope : relationsWithinScope) {
try {
var relationWithinScopeUri = RelationsUri.constructRelationUri(scopeName, relationWithinScope);
var relationWithinScopeObjectProperty = this.relationLabelToUnlPropertyConverter.getObjectProperty(relationWithinScope.getRelationLabel(), docModel);
sentenceOntModel.createIndividual(relationWithinScopeUri, relationWithinScopeObjectProperty);
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
}
});
for (var relation : sentencegraph.getRelations()) {
var relationUri = RelationsUri.constructRelationUri(sentenceNameSpace, relation);
......
......@@ -6,7 +6,6 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/test/java" isTestSource="true" />
<sourceFolder url="file://$MODULE_DIR$/target/generated-sources/annotations" isTestSource="false" generated="true" />
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
<orderEntry type="inheritedJdk" />
......
......@@ -26,6 +26,12 @@ class Unl2RdfTest {
Assertions.assertDoesNotThrow(() -> Unl2Rdf.main(new String[]{"--input-file", "../Examples/r1.txt", "--output-file", "r1", "--output-type", "rdf"}));
}
@Tag("integration")
@Test
public void r2ShouldBeConvertedToRdfFile(){
Assertions.assertDoesNotThrow(() -> Unl2Rdf.main(new String[]{"--input-file", "../Examples/r2.txt", "--output-file", "r2", "--output-type", "rdf"}));
}
@Tag("integration")
@Test
public void catShouldBeConvertedToRdfFile(){
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment