From 2a233c9bfabdd589dd55e76ddcc6df1431069c5c Mon Sep 17 00:00:00 2001 From: Bernd Kiefer Date: Fri, 19 Jul 2024 20:08:56 +0200 Subject: [PATCH] Get rid of string constants in code --- .../compiler/tree/DialogueActTest.java | 19 ++++--- .../ontologies/common/dialogue/dialogue.nt | 2 + .../ontologies/common/dialogue/dialogue.owl | 9 +++ .../mlt/rudimant/agent/nlp/DialogueAct.java | 56 ++++++++++++------- 4 files changed, 57 insertions(+), 29 deletions(-) diff --git a/compiler/src/test/java/de/dfki/mlt/rudimant/compiler/tree/DialogueActTest.java b/compiler/src/test/java/de/dfki/mlt/rudimant/compiler/tree/DialogueActTest.java index ff2feafe..4476cf6f 100644 --- a/compiler/src/test/java/de/dfki/mlt/rudimant/compiler/tree/DialogueActTest.java +++ b/compiler/src/test/java/de/dfki/mlt/rudimant/compiler/tree/DialogueActTest.java @@ -18,6 +18,7 @@ */ package de.dfki.mlt.rudimant.compiler.tree; +import static de.dfki.mlt.rudimant.agent.nlp.DialogueAct.*; import static de.dfki.mlt.rudimant.compiler.tree.TestHelper.*; import static de.dfki.mlt.rudimant.compiler.tree.TestUtilities.*; @@ -97,11 +98,11 @@ public void testToStringDA() { @Test public void testFromRdf() { - Rdf da = _proxy.getClass("").getNewInstance("dial:"); + Rdf da = _proxy.getClass("").getNewInstance(DIAL_NS); da.setValue("", "someone"); - Rdf frame = _proxy.getClass("").getNewInstance("dial:"); + Rdf frame = _proxy.getClass("").getNewInstance(DIAL_NS); da.setValue("", "someone else"); - da.setValue("", frame); + da.setValue(FRAME_PROPERTY, frame); DialogueAct transformed = DialogueAct.fromRdfProper(da.getURI(), _proxy); @@ -115,11 +116,11 @@ public void testFromRdf() { @Test public void testFromRdf2() { - Rdf da = _proxy.getClass("").getNewInstance("dial:"); + Rdf da = _proxy.getClass("").getNewInstance(DIAL_NS); da.setValue("", "someone"); - Rdf frame = _proxy.getClass("").getNewInstance("dial:"); + Rdf frame = _proxy.getClass(FRAME_RDFCLASS).getNewInstance(DIAL_NS); da.setValue("", "someone else"); - frame.setValue("", "Foo"); + frame.setValue("", "Foo"); da.setValue("", frame); DialogueAct transformed = DialogueAct.fromRdfProper(da.getURI(), _proxy); @@ -134,7 +135,7 @@ public void testFromRdf2() { @Test public void testToRdf2() { - Rdf sender = _proxy.getClass("").getNewInstance("dial:"); + Rdf sender = _proxy.getClass("").getNewInstance(DIAL_NS); DialogueAct da = new DialogueAct("@raw:ReturnGreeting(Meeting" + " ^