From 7ec211d068bd96449b4a17ddc04e7b6a950acb87 Mon Sep 17 00:00:00 2001 From: Alan <68600416+Qiming-Liu@users.noreply.github.com> Date: Thu, 7 Oct 2021 18:09:33 +1030 Subject: [PATCH] Fix issue17 --- src/main/java/uk/ac/ucl/cs/mr/FactsResource.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/main/java/uk/ac/ucl/cs/mr/FactsResource.java b/src/main/java/uk/ac/ucl/cs/mr/FactsResource.java index a772799..2bc4cbd 100644 --- a/src/main/java/uk/ac/ucl/cs/mr/FactsResource.java +++ b/src/main/java/uk/ac/ucl/cs/mr/FactsResource.java @@ -31,12 +31,17 @@ public FactsBean query(String sentence) { List facts = new ArrayList<>(); - for (AnnotatedProposition ap: minie.getPropositions()) { + for (AnnotatedProposition ap : minie.getPropositions()) { List triple = ap.getTriple(); - String s = triple.get(0).toString(); - String p = triple.get(1).toString(); - String o = triple.get(2).toString(); + String s = ""; + String p = ""; + String o = ""; + try { + s = triple.get(0).toString(); + p = triple.get(1).toString(); + o = triple.get(2).toString(); + } catch (IndexOutOfBoundsException ignored){} Fact fact = new Fact(s, p, o); facts.add(fact);