FluoStringConverter { public static String toStatementPatternString(final StatementPattern sp) { checkNotNull(sp); final Var subjVar = sp.getSubjectVar(); String subj = subjVar.getName(); if(subjVar.getValue() != null) { final Value subjValue = subjVar.getValue(); subj = VarNameUtils.createSimpleConstVarName(subjVar); if (subjValue instanceof BNode ) { subj = subj + TYPE_DELIM + RyaSchema.BNODE_NAMESPACE + TYPE_DELIM + ((BNode) subjValue).getID(); } else { subj = subj + TYPE_DELIM + URI_TYPE; } } final Var predVar = sp.getPredicateVar(); String pred = predVar.getName(); if(predVar.getValue() != null) { pred = VarNameUtils.createSimpleConstVarName(predVar); pred = pred + TYPE_DELIM + URI_TYPE; } final Var objVar = sp.getObjectVar(); String obj = objVar.getName(); if (objVar.getValue() != null) { final Value objValue = objVar.getValue(); obj = VarNameUtils.createSimpleConstVarName(objVar); final RyaType rt = RdfToRyaConversions.convertValue(objValue); obj = obj + TYPE_DELIM + rt.getDataType().stringValue(); } return subj + DELIM + pred + DELIM + obj; }  static String[] toBindingStrings(final String bindingSetString); static StatementPattern toStatementPattern(final String patternString); static Var toVar(final String varString); static String toStatementPatternString(final StatementPattern sp);  }
@Test public void statementPatternToString() throws MalformedQueryException { final Var subject = new Var("x"); final Var predicate = new Var(prependConstant("http: predicate.setConstant(true); final Var object = new Var(prependConstant("http: object.setConstant(true); final StatementPattern pattern = new StatementPattern(subject, predicate, object); final String spString = FluoStringConverter.toStatementPatternString(pattern); final String expected = "x:::" + prependConstant("http: prependConstant("http: assertEquals(spString, expected); }