From 15361ad600bdc6f5e315200f751c73dc50bf9ef6 Mon Sep 17 00:00:00 2001 From: Jim Balhoff Date: Mon, 19 Sep 2022 13:53:04 -0400 Subject: [PATCH] Provide backward compatibility for predicate methods. --- .../org/hl7/fhir/utilities/turtle/Turtle.java | 28 +++++++++++++------ 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/turtle/Turtle.java b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/turtle/Turtle.java index 833eae711..1053dbf7f 100644 --- a/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/turtle/Turtle.java +++ b/org.hl7.fhir.utilities/src/main/java/org/hl7/fhir/utilities/turtle/Turtle.java @@ -71,6 +71,10 @@ public class Turtle { public class Complex extends Triple { protected List predicates = new ArrayList(); + public Complex predicate(String predicate, String object) { + return predicate(predicate, object, false); + } + public Complex predicate(String predicate, String object, boolean asList) { predicateSet.add(predicate); objectSet.add(object); @@ -82,8 +86,12 @@ public class Turtle { objectSet.add(object); return linkedPredicate(predicate, new StringType(object), link); } + + public Complex predicate(String predicate, Triple object) { + return predicate(predicate, object, false); + } - public Complex predicate(String predicate, Triple object, boolean asList) { + public Complex predicate(String predicate, Triple object, boolean asList) { Predicate p = getPredicate(predicate); if (p == null) { p = new Predicate(); @@ -96,7 +104,7 @@ public class Turtle { objectSet.add(((StringType) object).value); p.objects.add(object); return this; - } + } protected Predicate getPredicate(String predicate) { for (Predicate p : predicates) @@ -119,13 +127,17 @@ public class Turtle { p.objects.add(object); return this; } + + public Complex predicate(String predicate) { + return predicate(predicate, false); + } - public Complex predicate(String predicate, boolean asList) { - predicateSet.add(predicate); - Complex c = complex(); - predicate(predicate, c, asList); - return c; - } + public Complex predicate(String predicate, boolean asList) { + predicateSet.add(predicate); + Complex c = complex(); + predicate(predicate, c, asList); + return c; + } public Complex linkedPredicate(String predicate, String link) { predicateSet.add(predicate);