diff --git a/unl-tools-core/src/main/java/fr/tetras_libre/unltools/unl/SubGraphReferenceNode.java b/unl-tools-core/src/main/java/fr/tetras_libre/unltools/unl/SubGraphReferenceNode.java index c98206da4297fcdce71370dae49c1018400d6f06..47f23ba46385f28c9d348f03bc88c246c7c04436 100644 --- a/unl-tools-core/src/main/java/fr/tetras_libre/unltools/unl/SubGraphReferenceNode.java +++ b/unl-tools-core/src/main/java/fr/tetras_libre/unltools/unl/SubGraphReferenceNode.java @@ -16,7 +16,7 @@ public class SubGraphReferenceNode extends GraphNode { } public String getNodeId() { - return null; + return referenceNumber; } public String getReferenceNumber() { diff --git a/unl-tools-core/src/main/java/fr/tetras_libre/unltools/unl/builders/UniversalWordNodeBuilder.java b/unl-tools-core/src/main/java/fr/tetras_libre/unltools/unl/builders/UniversalWordNodeBuilder.java index 77021800087bc9adb62bc2c2195a145678d698b7..567746f93c3c2740e06233681466b42e3d3ddba4 100644 --- a/unl-tools-core/src/main/java/fr/tetras_libre/unltools/unl/builders/UniversalWordNodeBuilder.java +++ b/unl-tools-core/src/main/java/fr/tetras_libre/unltools/unl/builders/UniversalWordNodeBuilder.java @@ -4,16 +4,17 @@ import fr.tetras_libre.unltools.unl.UniversalWord; import fr.tetras_libre.unltools.unl.UniversalWordNode; import java.util.HashSet; +import java.util.LinkedHashSet; import java.util.function.Function; import java.util.function.Supplier; public class UniversalWordNodeBuilder { - private final HashSet<String> attributes; + private final LinkedHashSet<String> attributes; private UniversalWord universalWord; private String instanceNumber; private UniversalWordNodeBuilder() { - this.attributes = new HashSet<>(); + this.attributes = new LinkedHashSet<>(); this.instanceNumber = ""; } diff --git a/unl-tools-infrastructure/src/test/java/fr/tetras_libre/unltools/unl/Issue12Unl.java b/unl-tools-infrastructure/src/test/java/fr/tetras_libre/unltools/unl/Issue12Unl.java index 4be29b0b88ecd43538c54f32b3d27cd847eea05f..5ad6b076995d2c4486cca93eb5a89bc86b3e01c9 100644 --- a/unl-tools-infrastructure/src/test/java/fr/tetras_libre/unltools/unl/Issue12Unl.java +++ b/unl-tools-infrastructure/src/test/java/fr/tetras_libre/unltools/unl/Issue12Unl.java @@ -14,286 +14,712 @@ public class Issue12Unl extends AbstractFlyweightUnlArgumentProvider { private UnlDocumentNode createSentence1() { return UnlDocumentNodeBuilder - .createBuilder() - .withNodeType(UnlDocumentNodeType.Sentence) - .withLabel("[S:00]") - .withGraph( - gb -> - gb.addGraphRelation( - grb -> grb.label("mod") - .noReference() - .leftNode( - lnb -> - lnb.universalWord( - uwb -> uwb.headWord("document") - .addTernaryTransitiveRestriction("icl", "writing", "thing", RestrictionOrientation.Right) - ) - ) - .rightNode( - lnb -> - lnb.universalWord( - uwb -> uwb.headWord("this") - .addTernaryTransitiveRestriction("icl", "determiner", "adj", RestrictionOrientation.Right) - .addSimpleRestriction("mod", RestrictionOrientation.Left, "concrete_thing") - ) - ) - ) - .addGraphRelation( - grb -> grb.label("aoj") - .noReference() - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("define") - .addTernaryTransitiveRestriction("icl", "characterize", "be", RestrictionOrientation.Right) - .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") - .addSimpleRestriction("aoj", RestrictionOrientation.Right, "thing") - ) - .addAttribute(".@entry") - .addAttribute(".@present") - ) - .rightNode( - rnb -> rnb.universalWord( - uwb -> uwb.headWord("document") - .addTernaryTransitiveRestriction("icl", "writing", "thing", RestrictionOrientation.Right) - ) - ) - ) - .addGraphRelation( - grb -> grb.label("mod") - .noReference() - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("requirement") - .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) - ) - .addAttribute(".@def") - .addAttribute(".@pl") - ) - .rightNode( - rnb -> rnb.universalWord( - uwb -> uwb.headWord("functional") - .addSimpleRestriction("icl", RestrictionOrientation.Right, "adj") - .addSimpleRestriction("ant", RestrictionOrientation.Right, "nonfunctional") - ) - ) - ) - .addGraphRelation( - grb -> - grb.label("obj") - .noReference() - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("define") - .addTernaryTransitiveRestriction("icl", "characterize", "be", RestrictionOrientation.Right) - .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") - .addSimpleRestriction("aoj", RestrictionOrientation.Right, "thing") - ) - .addAttribute(".@entry") - .addAttribute(".@present") - ) - .rightNode( - rnb -> rnb.universalWord( - uwb -> uwb.headWord("requirement") - .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) - ) - .addAttribute(".@def") - .addAttribute(".@pl") - ) - ) - .addGraphRelation( - grb -> grb.label("or") - .noReference() - .leftNode( - lnb -> lnb.simpleUniversalWord(() -> "etcs") - ) - .rightNode( - rnb -> rnb.simpleUniversalWord(() -> "ertms") - ) - ) - .addGraphRelation( - grb -> grb.label("pur") - .noReference() - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("requirement") - .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) - ) - .addAttribute(".@def") - .addAttribute(".@pl") - ) - .rightNode( - rnb -> rnb.simpleUniversalWord(() -> "etcs") - ) + .createBuilder() + .withNodeType(UnlDocumentNodeType.Sentence) + .withLabel("[S:00]") + .withGraph( + gb -> + gb.addGraphRelation( + grb -> grb.label("mod") + .noReference() + .leftNode( + lnb -> + lnb.universalWord( + uwb -> uwb.headWord("document") + .addTernaryTransitiveRestriction("icl", "writing", "thing", RestrictionOrientation.Right) + ) + ) + .rightNode( + lnb -> + lnb.universalWord( + uwb -> uwb.headWord("this") + .addTernaryTransitiveRestriction("icl", "determiner", "adj", RestrictionOrientation.Right) + .addSimpleRestriction("mod", RestrictionOrientation.Left, "concrete_thing") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("aoj") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("define") + .addTernaryTransitiveRestriction("icl", "characterize", "be", RestrictionOrientation.Right) + .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") + .addSimpleRestriction("aoj", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("document") + .addTernaryTransitiveRestriction("icl", "writing", "thing", RestrictionOrientation.Right) + ) + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("requirement") + .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) + ) + .addAttribute(".@def") + .addAttribute(".@pl") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("functional") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "adj") + .addSimpleRestriction("ant", RestrictionOrientation.Right, "nonfunctional") + ) + ) + ) + .addGraphRelation( + grb -> + grb.label("obj") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("define") + .addTernaryTransitiveRestriction("icl", "characterize", "be", RestrictionOrientation.Right) + .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") + .addSimpleRestriction("aoj", RestrictionOrientation.Right, "thing") ) - .addGraphRelation( - grb -> - grb.label("mod") - .reference(":01") - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("management") - .addSimpleRestriction("icl", RestrictionOrientation.Right, "action") - .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") - .addSimpleRestriction("obj", RestrictionOrientation.Right, "thing") - ) - ) - .rightNode( - rnb -> rnb.universalWord( - uwb -> uwb.headWord("traffic") - .addTernaryTransitiveRestriction("icl", "collection", "thing", RestrictionOrientation.Right) - ) - ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("requirement") + .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) ) - .addGraphRelation( - grb -> grb.label("mod") - .noReference() - .leftSubGraphNode( - lsgrb -> lsgrb.referenceNumber(":03") - .addAttribute(".@_hn-scope") - ) - .rightNode( - rnb -> rnb.universalWord( - uwb -> uwb.headWord("management") - .addSimpleRestriction("icl", RestrictionOrientation.Right, "action") - .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") - .addSimpleRestriction("obj", RestrictionOrientation.Right, "thing") - ) - ) + .addAttribute(".@def") + .addAttribute(".@pl") + ) + ) + .addGraphRelation( + grb -> grb.label("or") + .noReference() + .leftNode( + lnb -> lnb.simpleUniversalWord(() -> "etcs") + ) + .rightNode( + rnb -> rnb.simpleUniversalWord(() -> "ertms") + ) + ) + .addGraphRelation( + grb -> grb.label("pur") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("requirement") + .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) + ) + .addAttribute(".@def") + .addAttribute(".@pl") + ) + .rightNode( + rnb -> rnb.simpleUniversalWord(() -> "etcs") + ) + ) + .addGraphRelation( + grb -> + grb.label("mod") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("management") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "action") + .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "thing") ) - .addGraphRelation( - grb -> grb.label("or") - .reference(":03") - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("european") - .addTernaryTransitiveRestriction("icl", "inhabitant", "person", RestrictionOrientation.Right) - ) - .addAttribute(".@entry") - ) - .rightNode( - rnb -> rnb.universalWord( - uwb -> uwb.headWord("system") - .addTernaryTransitiveRestriction("icl", "group", "thing", RestrictionOrientation.Right) - ) - .instanceNumber(":01") - .addAttribute(".@entry") - ) + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("traffic") + .addTernaryTransitiveRestriction("icl", "collection", "thing", RestrictionOrientation.Right) ) - .addGraphRelation( - grb -> grb.label("mod") - .reference(":01") - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("control") - .addTernaryTransitiveRestriction("icl", "power", "thing", RestrictionOrientation.Right) - ) - ) - .rightNode( - rnb -> rnb.universalWord( - uwb -> uwb.headWord("train") - .addTernaryTransitiveRestriction("icl", "public_transport", "thing", RestrictionOrientation.Right) + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .noReference() + .leftSubGraphNode( + lsgrb -> lsgrb.referenceNumber(":03") + .addAttribute(".@_hn-scope") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("management") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "action") + .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "thing") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("or") + .reference(":03") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("european") + .addTernaryTransitiveRestriction("icl", "inhabitant", "person", RestrictionOrientation.Right) + ) + .addAttribute(".@entry") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("system") + .addTernaryTransitiveRestriction("icl", "group", "thing", RestrictionOrientation.Right) + ) + .instanceNumber(":01") + .addAttribute(".@entry") + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("control") + .addTernaryTransitiveRestriction("icl", "power", "thing", RestrictionOrientation.Right) + ) + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("train") + .addTernaryTransitiveRestriction("icl", "public_transport", "thing", RestrictionOrientation.Right) - ) - ) - ) - .addGraphRelation( - grb -> grb.label("mod") - .reference(":01") - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("system") - .addTernaryTransitiveRestriction("icl", "group", "thing", RestrictionOrientation.Right) - ) - .instanceNumber(":02") - ) - .rightNode( - rnb -> rnb.universalWord( - uwb -> uwb.headWord("control") - .addTernaryTransitiveRestriction("icl", "power", "thing", RestrictionOrientation.Right) - ) - ) - ) - .addGraphRelation( - grb -> grb.label("agt") - .reference(":02") - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("rail") - .addTernaryTransitiveRestriction("icl", "complain", "do", RestrictionOrientation.Right) - .addSimpleRestriction("rsn", RestrictionOrientation.Right, "thing") - .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") - ) - .addAttribute(".@entry") - .addAttribute(".@present") - ) - .rightSubGraphNode( - sgnb -> sgnb.referenceNumber(":01") - .addAttribute(".@entry") - .addAttribute(".@parenthesis") - ) - ) - .addGraphRelation( - grb -> grb.label("rsn") - .reference(":02") - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("rail") - .addTernaryTransitiveRestriction("icl", "complain", "do", RestrictionOrientation.Right) - .addSimpleRestriction("rsn", RestrictionOrientation.Right, "thing") - .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") - ) - .addAttribute(".@entry") - .addAttribute(".@present") - ) - .rightSubGraphNode( - rsngb -> rsngb.referenceNumber(":01") - .addAttribute(".@entry") - .addAttribute(".@parenthesis") - ) - ) - .addGraphRelation( - grb -> grb.label("shd") - .noReference() - .leftNode( - lnb -> lnb.simpleUniversalWord(() -> "etcs") - ) - .rightSubGraphNode( - rsgnb -> rsgnb.referenceNumber(":02") - ) - ) - .addGraphRelation( - grb -> grb.label("mod") - .noReference() - .leftNode( - lnb -> lnb.universalWord( - uwb -> uwb.headWord("train") - .addTernaryTransitiveRestriction("icl", "public_transport", "thing", RestrictionOrientation.Right) - ) - ) - .rightSubGraphNode( - rsgnb -> rsgnb.referenceNumber(":03") - .addAttribute(".@_hn-scope") - ) - ) - ) - .buildUnlDocumentNode(); + ) + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("system") + .addTernaryTransitiveRestriction("icl", "group", "thing", RestrictionOrientation.Right) + ) + .instanceNumber(":02") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("control") + .addTernaryTransitiveRestriction("icl", "power", "thing", RestrictionOrientation.Right) + ) + ) + ) + .addGraphRelation( + grb -> grb.label("agt") + .reference(":02") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("rail") + .addTernaryTransitiveRestriction("icl", "complain", "do", RestrictionOrientation.Right) + .addSimpleRestriction("rsn", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightSubGraphNode( + sgnb -> sgnb.referenceNumber(":01") + .addAttribute(".@entry") + .addAttribute(".@parenthesis") + ) + ) + .addGraphRelation( + grb -> grb.label("rsn") + .reference(":02") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("rail") + .addTernaryTransitiveRestriction("icl", "complain", "do", RestrictionOrientation.Right) + .addSimpleRestriction("rsn", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightSubGraphNode( + rsngb -> rsngb.referenceNumber(":01") + .addAttribute(".@entry") + .addAttribute(".@parenthesis") + ) + ) + .addGraphRelation( + grb -> grb.label("shd") + .noReference() + .leftNode( + lnb -> lnb.simpleUniversalWord(() -> "etcs") + ) + .rightSubGraphNode( + rsgnb -> rsgnb.referenceNumber(":02") + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("train") + .addTernaryTransitiveRestriction("icl", "public_transport", "thing", RestrictionOrientation.Right) + ) + ) + .rightSubGraphNode( + rsgnb -> rsgnb.referenceNumber(":03") + .addAttribute(".@_hn-scope") + ) + ) + ) + .buildUnlDocumentNode(); } private UnlDocumentNode createSentence2() { - return null; + return UnlDocumentNodeBuilder + .createBuilder() + .withNodeType(UnlDocumentNodeType.Sentence) + .withLabel("[S:00]") + .withGraph( + gb -> gb.addGraphRelation( + grb -> grb.label("aoj") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("define") + .addTernaryTransitiveRestriction("icl", "characterize", "be", RestrictionOrientation.Right) + .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") + .addSimpleRestriction("aoj", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("document") + .addTernaryTransitiveRestriction("icl", "writing", "thing", RestrictionOrientation.Right) + ) + .addAttribute(".@def") + ) + ) + .addGraphRelation( + grb -> grb.label("man") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("define") + .addTernaryTransitiveRestriction("icl", "characterize", "be", RestrictionOrientation.Right) + .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") + .addSimpleRestriction("aoj", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("primarily") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "how") + .addSimpleRestriction("equ", RestrictionOrientation.Right, "mainly") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("and") + .noReference() + .leftSubGraphNode( + lnb -> lnb.referenceNumber(":01") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("define") + .addTernaryTransitiveRestriction("icl", "characterize", "be", RestrictionOrientation.Right) + .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") + .addSimpleRestriction("aoj", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("requirement") + .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) + ) + .addAttribute(".@def") + .addAttribute(".@pl") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("operational") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "adj") + .addSimpleRestriction("com", RestrictionOrientation.Right, "operation") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("obj") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("define") + .addTernaryTransitiveRestriction("icl", "characterize", "be", RestrictionOrientation.Right) + .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") + .addSimpleRestriction("aoj", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("requirement") + .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) + ) + .addAttribute(".@def") + .addAttribute(".@pl") + ) + ) + .addGraphRelation( + grb -> grb.label("man") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("contain") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "be") + .addSimpleRestriction("equ", RestrictionOrientation.Right, "comprise") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "abstract_thing") + .addSimpleRestriction("aoj", RestrictionOrientation.Right, "information") + .addSimpleRestriction("pur", RestrictionOrientation.Right, "abstract_thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("therefore") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "how") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("man") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("term") + .addTernaryTransitiveRestriction("icl", "word", "thing", RestrictionOrientation.Right) + .addSimpleRestriction("mod", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@pl") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("only") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "how") + .addSimpleRestriction("equ", RestrictionOrientation.Right, "recently") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("qua") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("term") + .addTernaryTransitiveRestriction("icl", "word", "thing", RestrictionOrientation.Right) + .addSimpleRestriction("mod", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@pl") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("a_few") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "adj") + .addSimpleRestriction("equ", RestrictionOrientation.Right, "some") + .addSimpleRestriction("qua", RestrictionOrientation.Left, "thing") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("term") + .addTernaryTransitiveRestriction("icl", "word", "thing", RestrictionOrientation.Right) + .addSimpleRestriction("mod", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@pl") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("technical") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "adj") + .addSimpleRestriction("ant", RestrictionOrientation.Right, "nontechnical") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("obj") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("contain") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "be") + .addSimpleRestriction("equ", RestrictionOrientation.Right, "comprise") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "abstract_thing") + .addSimpleRestriction("aoj", RestrictionOrientation.Right, "information") + .addSimpleRestriction("pur", RestrictionOrientation.Right, "abstract_thing") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("term") + .addTernaryTransitiveRestriction("icl", "word", "thing", RestrictionOrientation.Right) + .addSimpleRestriction("mod", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@pl") + ) + ) + ) + .buildUnlDocumentNode(); } private UnlDocumentNode createSentence3() { - return null; + return UnlDocumentNodeBuilder + .createBuilder() + .withNodeType(UnlDocumentNodeType.Sentence) + .withLabel("[S:00]") + .withGraph( + gb -> gb.addGraphRelation( + grb -> grb.label("agt") + .reference(":01") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("reason") + .addTernaryTransitiveRestriction("icl", "persuade", "do", RestrictionOrientation.Right) + .addSimpleRestriction("agt", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("gol", RestrictionOrientation.Right, "uw") + .addSimpleRestriction("rec", RestrictionOrientation.Right, "person") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("consistency") + .addTernaryTransitiveRestriction("icl", "uniformity", "thing", RestrictionOrientation.Right) + .addSimpleRestriction("ant", RestrictionOrientation.Right, "inconsistency") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("qua") + .reference(":02") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("requirement") + .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) + ) + .addAttribute(".@pl") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("all") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "quantity") + .addSimpleRestriction("ant", RestrictionOrientation.Right, "some") + .addSimpleRestriction("per", RestrictionOrientation.Right, "thing") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .reference(":02") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("requirement") + .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) + ) + .addAttribute(".@pl") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("functional") + .addSimpleRestriction("icl", RestrictionOrientation.Right, "adj") + .addSimpleRestriction("ant", RestrictionOrientation.Right, "nonfunctional") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("agt") + .reference(":02") + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("implement") + .addTernaryTransitiveRestriction("icl", "employ", "do", RestrictionOrientation.Right) + .addSimpleRestriction("agt", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@past") + .addAttribute(".@not") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("requirement") + .addTernaryTransitiveRestriction("icl", "duty", "thing", RestrictionOrientation.Right) + ) + .addAttribute(".@pl") + ) + ) + .addGraphRelation( + grb -> grb.label("plc") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("remove") + .addTernaryTransitiveRestriction("icl", "dismiss", "do", RestrictionOrientation.Right) + .addSimpleRestriction("plf", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "person") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + .addAttribute(".@complete") + ) + .rightNode( + rnb -> rnb.simpleUniversalWord(() -> "srs") + .addAttribute(".@def") + ) + ) + .addGraphRelation( + grb -> grb.label("obj") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("remove") + .addTernaryTransitiveRestriction("icl", "dismiss", "do", RestrictionOrientation.Right) + .addSimpleRestriction("plf", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "person") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + .addAttribute(".@complete") + ) + .rightNode( + rnb -> rnb.simpleUniversalWord(() -> "\"2.3\"") + .addAttribute(".@topic") + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .noReference() + .leftNode( + lnb -> lnb.simpleUniversalWord(() -> "\"2.3\"") + .addAttribute(".@topic") + ) + .rightNode( + rnb -> rnb.simpleUniversalWord(() -> "\".0\"") + ) + ) + .addGraphRelation( + grb -> grb.label("mod") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("version") + .addTernaryTransitiveRestriction("icl", "interpretation", "abstract_thing", RestrictionOrientation.Right) + .addSimpleRestriction("agt", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") + ) + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("this") + .addTernaryTransitiveRestriction("icl", "determiner", "adj", RestrictionOrientation.Right) + .addSimpleRestriction("mod", RestrictionOrientation.Left, "concrete_thing") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("plf") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("remove") + .addTernaryTransitiveRestriction("icl", "dismiss", "do", RestrictionOrientation.Right) + .addSimpleRestriction("plf", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "person") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + .addAttribute(".@complete") + ) + .rightNode( + rnb -> rnb.universalWord( + uwb -> uwb.headWord("version") + .addTernaryTransitiveRestriction("icl", "interpretation", "abstract_thing", RestrictionOrientation.Right) + .addSimpleRestriction("agt", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "uw") + ) + ) + ) + .addGraphRelation( + grb -> grb.label("and") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("implement") + .addTernaryTransitiveRestriction("icl", "employ", "do", RestrictionOrientation.Right) + .addSimpleRestriction("agt", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "thing") + ) + .addAttribute(".@past") + .addAttribute(".@not") + ) + .rightSubGraphNode( + rsgnb -> rsgnb.referenceNumber(":01") + ) + ) + .addGraphRelation( + grb -> grb.label("rsn") + .noReference() + .leftNode( + lnb -> lnb.universalWord( + uwb -> uwb.headWord("remove") + .addTernaryTransitiveRestriction("icl", "dismiss", "do", RestrictionOrientation.Right) + .addSimpleRestriction("plf", RestrictionOrientation.Right, "thing") + .addSimpleRestriction("agt", RestrictionOrientation.Right, "volitional_thing") + .addSimpleRestriction("obj", RestrictionOrientation.Right, "person") + ) + .addAttribute(".@entry") + .addAttribute(".@present") + .addAttribute(".@complete") + ) + .rightSubGraphNode( + rsgnb -> rsgnb.referenceNumber(":02") + ) + ) + ) + .buildUnlDocumentNode(); } @Override protected List<UnlDocument> buildUnlDocuments() { var unlDocument = new UnlDocument("[D]"); - UnlDocumentNode unlDocumentNode = createSentence1(); - - unlDocument.add(unlDocumentNode); + unlDocument.add(createSentence1()); + unlDocument.add(createSentence2()); + unlDocument.add(createSentence3()); return Collections.singletonList(unlDocument); } diff --git a/unl-tools-infrastructure/src/test/java/fr/tetras_libre/unltools/unl/UnlSentences.java b/unl-tools-infrastructure/src/test/java/fr/tetras_libre/unltools/unl/UnlSentences.java index 555be8e6cc63ea8952d4bf1b149170ee4cb9715d..34269cda05fa90d53dba73447bbbb3f40b7a7506 100644 --- a/unl-tools-infrastructure/src/test/java/fr/tetras_libre/unltools/unl/UnlSentences.java +++ b/unl-tools-infrastructure/src/test/java/fr/tetras_libre/unltools/unl/UnlSentences.java @@ -117,40 +117,40 @@ public class UnlSentences { "mod(train(icl>public_transport>thing),:03.@_hn-scope)\n" + "{/unl}\n" + "[/S]\n" + -// "[S:00]\n" + -// "{org:en}\n" + -// "The document primarily defines the operational requirements and therefore contains only a few technical terms.\n" + -// "{/org}\n" + -// "{unl}\n" + -// "aoj(define(icl>characterize>be,obj>uw,aoj>thing).@entry.@present,document(icl>writing>thing).@def)\n" + -// "man(define(icl>characterize>be,obj>uw,aoj>thing).@entry.@present,primarily(icl>how,equ>mainly))\n" + -// "and(:01,define(icl>characterize>be,obj>uw,aoj>thing).@entry.@present)\n" + -// "mod(requirement(icl>duty>thing).@def.@pl,operational(icl>adj,com>operation))\n" + -// "obj(define(icl>characterize>be,obj>uw,aoj>thing).@entry.@present,requirement(icl>duty>thing).@def.@pl)\n" + -// "man:01(contain(icl>be,equ>comprise,obj>abstract_thing,aoj>information,pur>abstract_thing).@entry.@present,therefore(icl>how))\n" + -// "man:01(term(icl>word>thing,mod>thing).@pl,only(icl>how,equ>recently))\n" + -// "qua:01(term(icl>word>thing,mod>thing).@pl,a_few(icl>adj,equ>some,qua<thing))\n" + -// "mod:01(term(icl>word>thing,mod>thing).@pl,technical(icl>adj,ant>nontechnical))\n" + -// "obj:01(contain(icl>be,equ>comprise,obj>abstract_thing,aoj>information,pur>abstract_thing).@entry.@present,term(icl>word>thing,mod>thing).@pl)\n" + -// "{/unl}\n" + -// "[/S]\n" + -// "[S:00]\n" + -// "{org:en}\n" + -// "For consistency reasons, all functional requirements not implemented in the SRS 2.3.0 have been removed from this version..\n" + -// "{/org}\n" + -// "{unl}\n" + -// "agt:01(reason(icl>persuade>do,agt>thing,gol>uw,rec>person).@entry.@present,consistency(icl>uniformity>thing,ant>inconsistency))\n" + -// "qua:02(requirement(icl>duty>thing).@pl,all(icl>quantity,ant>some,per>thing))\n" + -// "mod:02(requirement(icl>duty>thing).@pl,functional(icl>adj,ant>nonfunctional))\n" + -// "agt:02(implement(icl>employ>do,agt>thing,obj>thing).@past.@not,requirement(icl>duty>thing).@pl)\n" + -// "plc(remove(icl>dismiss>do,plf>thing,agt>volitional_thing,obj>person).@entry.@present.@complete,srs.@def)\n" + -// "obj(remove(icl>dismiss>do,plf>thing,agt>volitional_thing,obj>person).@entry.@present.@complete,\"2.3\".@topic)\n" + -// "mod(\"2.3\".@topic,\".0\")\n" + -// "mod(version(icl>interpretation>abstract_thing,agt>thing,obj>uw),this(icl>determiner>adj,mod<concrete_thing))\n" + -// "plf(remove(icl>dismiss>do,plf>thing,agt>volitional_thing,obj>person).@entry.@present.@complete,version(icl>interpretation>abstract_thing,agt>thing,obj>uw))\n" + -// "and(implement(icl>employ>do,agt>thing,obj>thing).@past.@not,:01)\n" + -// "rsn(remove(icl>dismiss>do,plf>thing,agt>volitional_thing,obj>person).@entry.@present.@complete,:02)\n" + -// "{/unl}\n" + -// "[/S]\n" + + "[S:00]\n" + + "{org:en}\n" + + "The document primarily defines the operational requirements and therefore contains only a few technical terms.\n" + + "{/org}\n" + + "{unl}\n" + + "aoj(define(icl>characterize>be,obj>uw,aoj>thing).@entry.@present,document(icl>writing>thing).@def)\n" + + "man(define(icl>characterize>be,obj>uw,aoj>thing).@entry.@present,primarily(icl>how,equ>mainly))\n" + + "and(:01,define(icl>characterize>be,obj>uw,aoj>thing).@entry.@present)\n" + + "mod(requirement(icl>duty>thing).@def.@pl,operational(icl>adj,com>operation))\n" + + "obj(define(icl>characterize>be,obj>uw,aoj>thing).@entry.@present,requirement(icl>duty>thing).@def.@pl)\n" + + "man:01(contain(icl>be,equ>comprise,obj>abstract_thing,aoj>information,pur>abstract_thing).@entry.@present,therefore(icl>how))\n" + + "man:01(term(icl>word>thing,mod>thing).@pl,only(icl>how,equ>recently))\n" + + "qua:01(term(icl>word>thing,mod>thing).@pl,a_few(icl>adj,equ>some,qua<thing))\n" + + "mod:01(term(icl>word>thing,mod>thing).@pl,technical(icl>adj,ant>nontechnical))\n" + + "obj:01(contain(icl>be,equ>comprise,obj>abstract_thing,aoj>information,pur>abstract_thing).@entry.@present,term(icl>word>thing,mod>thing).@pl)\n" + + "{/unl}\n" + + "[/S]\n" + + "[S:00]\n" + + "{org:en}\n" + + "For consistency reasons, all functional requirements not implemented in the SRS 2.3.0 have been removed from this version..\n" + + "{/org}\n" + + "{unl}\n" + + "agt:01(reason(icl>persuade>do,agt>thing,gol>uw,rec>person).@entry.@present,consistency(icl>uniformity>thing,ant>inconsistency))\n" + + "qua:02(requirement(icl>duty>thing).@pl,all(icl>quantity,ant>some,per>thing))\n" + + "mod:02(requirement(icl>duty>thing).@pl,functional(icl>adj,ant>nonfunctional))\n" + + "agt:02(implement(icl>employ>do,agt>thing,obj>thing).@past.@not,requirement(icl>duty>thing).@pl)\n" + + "plc(remove(icl>dismiss>do,plf>thing,agt>volitional_thing,obj>person).@entry.@present.@complete,srs.@def)\n" + + "obj(remove(icl>dismiss>do,plf>thing,agt>volitional_thing,obj>person).@entry.@present.@complete,\"2.3\".@topic)\n" + + "mod(\"2.3\".@topic,\".0\")\n" + + "mod(version(icl>interpretation>abstract_thing,agt>thing,obj>uw),this(icl>determiner>adj,mod<concrete_thing))\n" + + "plf(remove(icl>dismiss>do,plf>thing,agt>volitional_thing,obj>person).@entry.@present.@complete,version(icl>interpretation>abstract_thing,agt>thing,obj>uw))\n" + + "and(implement(icl>employ>do,agt>thing,obj>thing).@past.@not,:01)\n" + + "rsn(remove(icl>dismiss>do,plf>thing,agt>volitional_thing,obj>person).@entry.@present.@complete,:02)\n" + + "{/unl}\n" + + "[/S]\n" + "[/D]"; }