Skip to content
Snippets Groups Projects

Resolve "Pb d'attachement des relations aux scopes"

1 file
+ 27
35
Compare changes
  • Side-by-side
  • Inline
  • b063ec77
    correction for issue : · b063ec77
    Sebastien authored
    1- retrieve relation within a scope from graphReferenceNumber instead of scopeName
    2- add manually is_scope and has_scope
@@ -92,41 +92,33 @@ 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);
var scopeIndividual = sentenceOntModel.createIndividual(
UtilGraphNodeUri.constructGraphNodeUri(sentenceNameSpace, graphRefNode),
UNL.UNL_Scope);
scopeIndividual.addLabel(scopeName, "fr/tetras_libre/unltools/unl");
this.setSuperstructureWithSubstructure(sentenceOntModel, sentenceIndividual, sentenceOntModel, scopeIndividual);
/*
GraphExtensions.getRelationWithinScopeStream(scopeName, sentencegraph)
.forEach(relationWithinScope -> {
try {
var relationWithinScopeUri = RelationsUri.constructRelationUri(scopeName, relationWithinScope);
var relationWithinScopeObjectProperty = this.relationLabelToUnlPropertyConverter.getObjectProperty(relationWithinScope.getRelationLabel(), docModel);
sentenceOntModel.createIndividual(relationWithinScopeUri, relationWithinScopeObjectProperty);
} 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();
}
}
}
}
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);
scopeIndividual.addLabel(scopeName, "fr/tetras_libre/unltools/unl");
this.setSuperstructureWithSubstructure(sentenceOntModel, sentenceIndividual, sentenceOntModel, scopeIndividual);
GraphExtensions.getRelationWithinScopeStream(graphRefNode.getReferenceNumber(), sentencegraph)
.forEach(relationWithinScope -> {
try {
var relationWithinScopeUri = RelationsUri.constructRelationUri(scopeName, relationWithinScope);
var relationWithinScopeObjectProperty = this.relationLabelToUnlPropertyConverter.getObjectProperty(relationWithinScope.getRelationLabel(), docModel);
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();
}
});
});
for (var relation : sentencegraph.getRelations()) {
var relationUri = RelationsUri.constructRelationUri(sentenceNameSpace, relation);
Loading