diff --git a/core/src/main/java/org/semarglproject/source/SaxSource.java b/core/src/main/java/org/semarglproject/source/SaxSource.java index 5bd3445..70ae780 100644 --- a/core/src/main/java/org/semarglproject/source/SaxSource.java +++ b/core/src/main/java/org/semarglproject/source/SaxSource.java @@ -71,15 +71,23 @@ public void process(InputStream inputStream, String mimeType, String baseUri) th private void initXmlReader() throws SAXException { if (xmlReader == null) { - xmlReader = XMLReaderFactory.createXMLReader(); - xmlReader.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + xmlReader = getDefaultXmlReader(); } xmlReader.setContentHandler(sink); xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", sink); } - public void setXmlReader(XMLReader xmlReader) { - this.xmlReader = xmlReader; + public void setXmlReader(XMLReader xmlReader) throws SAXException { + if(xmlReader == null) { + this.xmlReader = getDefaultXmlReader(); + } else { + this.xmlReader = xmlReader; + } } + public static XMLReader getDefaultXmlReader() throws SAXException { + XMLReader result = XMLReaderFactory.createXMLReader(); + result.setFeature("http://apache.org/xml/features/nonvalidating/load-external-dtd", false); + return result; + } } diff --git a/core/src/main/java/org/semarglproject/source/StreamProcessor.java b/core/src/main/java/org/semarglproject/source/StreamProcessor.java index 667a90e..b74174d 100644 --- a/core/src/main/java/org/semarglproject/source/StreamProcessor.java +++ b/core/src/main/java/org/semarglproject/source/StreamProcessor.java @@ -17,6 +17,7 @@ import org.semarglproject.rdf.ParseException; import org.semarglproject.sink.DataSink; +import org.xml.sax.SAXException; import org.xml.sax.XMLReader; import java.io.InputStream; @@ -90,8 +91,14 @@ public void processInternal(Reader reader, String mimeType, String baseUri) thro public boolean setProperty(String key, Object value) { boolean result = false; if (XML_READER_PROPERTY.equals(key) && value instanceof XMLReader && source instanceof SaxSource) { - ((SaxSource) source).setXmlReader((XMLReader) value); - result = true; + try { + if (value != null) { + ((SaxSource) source).setXmlReader((XMLReader) value); + result = true; + } + } catch(SAXException e) { + throw new IllegalArgumentException("XMLReader was not able to be initialized", e); + } } return sink.setProperty(key, value) || result; } diff --git a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/RDFaFormat.java b/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/RDFaFormat.java deleted file mode 100644 index 0ef5097..0000000 --- a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/RDFaFormat.java +++ /dev/null @@ -1,36 +0,0 @@ -/** - * Copyright 2012-2013 Lev Khomich - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.semarglproject.sesame.rdf.rdfa; - -import org.openrdf.rio.RDFFormat; - -import java.nio.charset.Charset; -import java.util.Arrays; - -/** - * @author Peter Ansell p_ansell@yahoo.com - * - */ -public final class RDFaFormat { - - public static final RDFFormat RDFA = new RDFFormat("RDFa", Arrays.asList( - "application/xhtml+xml", "text/html", "image/svg+xml"), - Charset.forName("UTF-8"), Arrays.asList("xhtml, html, svg"), true, false); - - private RDFaFormat() { - } - -} diff --git a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/RdfaParserConfig.java b/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/RdfaParserConfig.java deleted file mode 100644 index a49fe26..0000000 --- a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/RdfaParserConfig.java +++ /dev/null @@ -1,83 +0,0 @@ -/** - * Copyright 2012-2013 Lev Khomich - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.semarglproject.sesame.rdf.rdfa; - -import org.openrdf.rio.ParserConfig; -import org.openrdf.rio.RDFParser; - -/** - * Holds configuration of {@link SesameRDFaParser}. - */ -public class RdfaParserConfig extends ParserConfig { - - private final boolean processorGraphEnabled; - private final boolean vocabExpansionEnabled; - private final short rdfaCompatibility; - - /** - * Creates configuration with disabled data verification, enabled stop at first error, enabled preserving - * of bnode IDs and disabled datatype handling. - * @param enableProcessorGraph see {@link SesameRDFaParser#setProcessorGraphEnabled(boolean)} - * @param enableVocabExpansion see {@link SesameRDFaParser#setVocabExpansionEnabled(boolean)} - * @param rdfaCompatibility see {@link SesameRDFaParser#setRdfaCompatibility(short)} - */ - public RdfaParserConfig(boolean enableProcessorGraph, boolean enableVocabExpansion, short rdfaCompatibility) { - super(false, true, true, RDFParser.DatatypeHandling.IGNORE); - this.processorGraphEnabled = enableProcessorGraph; - this.vocabExpansionEnabled = enableVocabExpansion; - this.rdfaCompatibility = rdfaCompatibility; - } - - /** - * Creates custom {@link SesameRDFaParser} configuration. - * @param verifyData see {@link SesameRDFaParser#setVerifyData(boolean)} - * @param stopAtFirstError see {@link SesameRDFaParser#setStopAtFirstError(boolean)} - * @param preserveBNodeIDs see {@link SesameRDFaParser#setPreserveBNodeIDs(boolean)} - * @param dtHandling see {@link SesameRDFaParser#setDatatypeHandling(org.openrdf.rio.RDFParser.DatatypeHandling)} - * @param enableProcessorGraph see {@link SesameRDFaParser#setProcessorGraphEnabled(boolean)} - * @param enableVocabExpansion see {@link SesameRDFaParser#setVocabExpansionEnabled(boolean)} - * @param rdfaCompatibility see {@link SesameRDFaParser#setRdfaCompatibility(short)} - */ - public RdfaParserConfig(boolean verifyData, boolean stopAtFirstError, - boolean preserveBNodeIDs, RDFParser.DatatypeHandling dtHandling, - boolean enableProcessorGraph, boolean enableVocabExpansion, short rdfaCompatibility) { - super(verifyData, stopAtFirstError, preserveBNodeIDs, dtHandling); - this.processorGraphEnabled = enableProcessorGraph; - this.vocabExpansionEnabled = enableVocabExpansion; - this.rdfaCompatibility = rdfaCompatibility; - } - - /** - * @return {@link org.semarglproject.rdf.rdfa.RdfaParser#ENABLE_PROCESSOR_GRAPH} setting - */ - public final boolean isProcessorGraphEnabled() { - return processorGraphEnabled; - } - - /** - * @return {@link org.semarglproject.rdf.rdfa.RdfaParser#ENABLE_VOCAB_EXPANSION} setting - */ - public final boolean isVocabExpansionEnabled() { - return vocabExpansionEnabled; - } - - /** - * @return {@link org.semarglproject.rdf.rdfa.RdfaParser#RDFA_VERSION_PROPERTY} setting - */ - public final short getRdfaCompatibility() { - return rdfaCompatibility; - } -} diff --git a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SemarglParserSettings.java b/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SemarglParserSettings.java new file mode 100644 index 0000000..b4dce32 --- /dev/null +++ b/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SemarglParserSettings.java @@ -0,0 +1,71 @@ +/** + * Copyright 2012-2013 Lev Khomich + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.semarglproject.sesame.rdf.rdfa; + +import org.openrdf.rio.ParserSetting; +import org.openrdf.rio.helpers.ParserSettingImpl; +import org.semarglproject.rdf.rdfa.RdfaParser; +import org.semarglproject.source.StreamProcessor; +import org.semarglproject.vocab.RDFa; +import org.xml.sax.XMLReader; + +/** + * Settings specific to Semargl that are not in {@link org.openrdf.rio.helpers.BasicParserSettings}. + * + * @author Peter Ansell p_ansell@yahoo.com + * @since 0.5 + */ +public final class SemarglParserSettings { + + /** + * TODO: Javadoc this setting + *

+ * Defaults to false + * @since 0.5 + */ + public static final ParserSetting VOCAB_EXPANSION_ENABLED = new ParserSettingImpl( + RdfaParser.ENABLE_VOCAB_EXPANSION, "Vocabulary Expansion", Boolean.FALSE); + + /** + * TODO: Javadoc this setting + *

+ * Defaults to false + * @since 0.5 + */ + public static final ParserSetting PROCESSOR_GRAPH_ENABLED = new ParserSettingImpl( + RdfaParser.ENABLE_PROCESSOR_GRAPH, "Vocabulary Expansion", Boolean.FALSE); + + /** + * TODO: Javadoc this setting + *

+ * Defaults to 1.1 + * @since 0.5 + */ + public static final ParserSetting RDFA_COMPATIBILITY = new ParserSettingImpl( + RdfaParser.RDFA_VERSION_PROPERTY, "RDFa Version Compatibility", RDFa.VERSION_11); + + /** + * TODO: Javadoc this setting + *

+ * Defaults to null + * @since 0.5 + */ + public static final ParserSetting CUSTOM_XML_READER = new ParserSettingImpl( + StreamProcessor.XML_READER_PROPERTY, "Custom XML Reader", null); + + private SemarglParserSettings() { + } +} diff --git a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SesameRDFaParser.java b/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SesameRDFaParser.java index 41162b0..5b692e7 100644 --- a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SesameRDFaParser.java +++ b/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SesameRDFaParser.java @@ -19,17 +19,18 @@ import org.openrdf.rio.ParseErrorListener; import org.openrdf.rio.ParseLocationListener; import org.openrdf.rio.ParserConfig; +import org.openrdf.rio.ParserSetting; import org.openrdf.rio.RDFFormat; import org.openrdf.rio.RDFHandler; import org.openrdf.rio.RDFHandlerException; import org.openrdf.rio.RDFParseException; import org.openrdf.rio.RDFParser; +import org.openrdf.rio.helpers.BasicParserSettings; import org.semarglproject.source.StreamProcessor; import org.semarglproject.rdf.ParseException; import org.semarglproject.rdf.ProcessorGraphHandler; import org.semarglproject.rdf.rdfa.RdfaParser; import org.semarglproject.sesame.core.sink.SesameSink; -import org.semarglproject.vocab.RDFa; import org.xml.sax.XMLReader; import java.io.IOException; @@ -37,9 +38,11 @@ import java.io.InputStreamReader; import java.io.Reader; import java.nio.charset.Charset; +import java.util.ArrayList; +import java.util.Collection; /** - * Implementation or Sesame's RDFParser on top of Semargl APIs. + * Implementation of Sesame's RDFParser on top of Semargl RDFaParser. * * @author Peter Ansell p_ansell@yahoo.com * @author Lev Khomich levkhomich@gmail.com @@ -47,10 +50,7 @@ */ public final class SesameRDFaParser implements RDFParser, ProcessorGraphHandler { - private boolean processorGraphEnabled; - private boolean vocabExpansionEnabled; - private boolean preserveBNodeIDs; - private short rdfaCompatibility; + private ParserConfig parserConfig; private final StreamProcessor streamProcessor; @@ -58,19 +58,17 @@ public final class SesameRDFaParser implements RDFParser, ProcessorGraphHandler /** * Default constructor. Creates RDFa parser in 1.1 mode with disabled vocabulary expansion feature. - * Properties can be changed using {@link #setParserConfig(org.openrdf.rio.ParserConfig)} method or - * object's setters. + *

+ * Supported settings can be found using {@link #getSupportedSettings()} and can be modified using + * the {@link ParserConfig} object returned from the {@link #getParserConfig()} method. */ public SesameRDFaParser() { - preserveBNodeIDs = true; - vocabExpansionEnabled = false; - processorGraphEnabled = false; - rdfaCompatibility = RDFa.VERSION_11; - parseErrorListener = null; + setParserConfig(new ParserConfig()); streamProcessor = new StreamProcessor(RdfaParser.connect(SesameSink.connect(null))); - streamProcessor.setProperty(RdfaParser.ENABLE_PROCESSOR_GRAPH, processorGraphEnabled); - streamProcessor.setProperty(RdfaParser.ENABLE_VOCAB_EXPANSION, vocabExpansionEnabled); streamProcessor.setProperty(StreamProcessor.PROCESSOR_GRAPH_HANDLER_PROPERTY, this); + // by default this would be set to false if not set here + setPreserveBNodeIDs(true); + parseErrorListener = null; } /** @@ -79,12 +77,12 @@ public SesameRDFaParser() { */ public SesameRDFaParser(XMLReader xmlReader) { this(); - streamProcessor.setProperty(StreamProcessor.XML_READER_PROPERTY, xmlReader); + setXmlReader(xmlReader); } @Override public RDFFormat getRDFFormat() { - return RDFaFormat.RDFA; + return RDFFormat.RDFA; } @Override @@ -103,6 +101,7 @@ public void parse(InputStream in, String baseURI) throws RDFParseException, RDFH @Override public void parse(Reader reader, String baseURI) throws RDFParseException, RDFHandlerException { + refreshSettings(); try { streamProcessor.process(reader, baseURI); } catch (ParseException e) { @@ -132,41 +131,47 @@ public void setParseLocationListener(ParseLocationListener ll) { @Override public void setParserConfig(ParserConfig config) { - if (config instanceof RdfaParserConfig) { - RdfaParserConfig rdfaParserConfig = (RdfaParserConfig) config; - setProcessorGraphEnabled(rdfaParserConfig.isProcessorGraphEnabled()); - setVocabExpansionEnabled(rdfaParserConfig.isVocabExpansionEnabled()); - setRdfaCompatibility(rdfaParserConfig.getRdfaCompatibility()); - } - this.preserveBNodeIDs = config.isPreserveBNodeIDs(); + this.parserConfig = config; } @Override - public RdfaParserConfig getParserConfig() { - return new RdfaParserConfig(false, false, preserveBNodeIDs, DatatypeHandling.IGNORE, - processorGraphEnabled, vocabExpansionEnabled, rdfaCompatibility); + public ParserConfig getParserConfig() { + return this.parserConfig; + } + + @Override + public Collection> getSupportedSettings() { + Collection> result = new ArrayList>(5); + + result.add(BasicParserSettings.PRESERVE_BNODE_IDS); + result.add(SemarglParserSettings.PROCESSOR_GRAPH_ENABLED); + result.add(SemarglParserSettings.VOCAB_EXPANSION_ENABLED); + result.add(SemarglParserSettings.RDFA_COMPATIBILITY); + result.add(SemarglParserSettings.CUSTOM_XML_READER); + + return result; } @Override public void setVerifyData(boolean verifyData) { - // ignore + // Does not support verification of data values, see getSupportedSettings for list of supported settings } @Override public void setPreserveBNodeIDs(boolean preserveBNodeIDs) { - this.preserveBNodeIDs = preserveBNodeIDs; + parserConfig.set(BasicParserSettings.PRESERVE_BNODE_IDS, preserveBNodeIDs); + refreshSettings(); } @Override public void setStopAtFirstError(boolean stopAtFirstError) { - // RDFa parser ignores all errors when possible by default + // Does not support changing this setting, see getSupportedSettings for list of supported settings + // RDFa parser ignores all errors when it is possible to continue } @Override public void setDatatypeHandling(DatatypeHandling datatypeHandling) { - if (!datatypeHandling.equals(DatatypeHandling.IGNORE)) { - throw new IllegalArgumentException("Parser doesn't support datatypeHandling = " + datatypeHandling.name()); - } + // Does not support datatype handling, see getSupportedSettings for list of supported settings } /** @@ -174,8 +179,8 @@ public void setDatatypeHandling(DatatypeHandling datatypeHandling) { * @param processorGraphEnabled new value to be set */ public void setProcessorGraphEnabled(boolean processorGraphEnabled) { - this.processorGraphEnabled = processorGraphEnabled; - streamProcessor.setProperty(RdfaParser.ENABLE_PROCESSOR_GRAPH, processorGraphEnabled); + parserConfig.set(SemarglParserSettings.PROCESSOR_GRAPH_ENABLED, processorGraphEnabled); + refreshSettings(); } /** @@ -183,8 +188,8 @@ public void setProcessorGraphEnabled(boolean processorGraphEnabled) { * @param vocabExpansionEnabled new value to be set */ public void setVocabExpansionEnabled(boolean vocabExpansionEnabled) { - this.vocabExpansionEnabled = vocabExpansionEnabled; - streamProcessor.setProperty(RdfaParser.ENABLE_VOCAB_EXPANSION, vocabExpansionEnabled); + parserConfig.set(SemarglParserSettings.VOCAB_EXPANSION_ENABLED, vocabExpansionEnabled); + refreshSettings(); } /** @@ -192,8 +197,31 @@ public void setVocabExpansionEnabled(boolean vocabExpansionEnabled) { * @param rdfaCompatibility new value to be set */ public void setRdfaCompatibility(short rdfaCompatibility) { - this.rdfaCompatibility = rdfaCompatibility; - streamProcessor.setProperty(RdfaParser.RDFA_VERSION_PROPERTY, rdfaCompatibility); + parserConfig.set(SemarglParserSettings.RDFA_COMPATIBILITY, rdfaCompatibility); + refreshSettings(); + } + + /** + * Sets a custom {@link XMLReader}. + * @param reader new value to be set + */ + public void setXmlReader(XMLReader reader) { + parserConfig.set(SemarglParserSettings.CUSTOM_XML_READER, reader); + refreshSettings(); + } + + /** + * Refreshes the settings on the stream processor using the current values from the parserConfig. + */ + private void refreshSettings() { + streamProcessor.setProperty(RdfaParser.RDFA_VERSION_PROPERTY, + parserConfig.get(SemarglParserSettings.RDFA_COMPATIBILITY)); + streamProcessor.setProperty(RdfaParser.ENABLE_VOCAB_EXPANSION, + parserConfig.get(SemarglParserSettings.VOCAB_EXPANSION_ENABLED)); + streamProcessor.setProperty(RdfaParser.ENABLE_PROCESSOR_GRAPH, + parserConfig.get(SemarglParserSettings.PROCESSOR_GRAPH_ENABLED)); + streamProcessor.setProperty(StreamProcessor.XML_READER_PROPERTY, + parserConfig.get(SemarglParserSettings.CUSTOM_XML_READER)); } @Override @@ -213,4 +241,5 @@ public void error(String errorClass, String message) { parseErrorListener.error(message, -1, -1); } } + } diff --git a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SesameRDFaParserFactory.java b/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SesameRDFaParserFactory.java index a2f7fd7..4b2ac17 100644 --- a/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SesameRDFaParserFactory.java +++ b/integration/sesame/src/main/java/org/semarglproject/sesame/rdf/rdfa/SesameRDFaParserFactory.java @@ -28,7 +28,7 @@ public final class SesameRDFaParserFactory implements RDFParserFactory { @Override public RDFFormat getRDFFormat() { - return RDFaFormat.RDFA; + return RDFFormat.RDFA; } @Override diff --git a/integration/sesame/src/test/java/org/semarglproject/sesame/SesameRdfaReaderTest.java b/integration/sesame/src/test/java/org/semarglproject/sesame/SesameRdfaReaderTest.java index db21331..1929cbb 100644 --- a/integration/sesame/src/test/java/org/semarglproject/sesame/SesameRdfaReaderTest.java +++ b/integration/sesame/src/test/java/org/semarglproject/sesame/SesameRdfaReaderTest.java @@ -24,9 +24,8 @@ import org.openrdf.rio.Rio; import org.openrdf.rio.helpers.StatementCollector; import org.semarglproject.rdf.ParseException; -import org.semarglproject.sesame.rdf.rdfa.RDFaFormat; -import org.semarglproject.sesame.rdf.rdfa.RdfaParserConfig; import org.semarglproject.rdf.rdfa.RdfaTestBundle; +import org.semarglproject.sesame.rdf.rdfa.SemarglParserSettings; import org.semarglproject.vocab.RDFa; import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeMethod; @@ -49,12 +48,15 @@ public class SesameRdfaReaderTest { @Override public void run(Reader input, String inputUri, Writer output, short rdfaVersion) throws ParseException { try { - RDFParser rdfParser = Rio.createParser(RDFaFormat.RDFA); - rdfParser.setParserConfig(new RdfaParserConfig(true, true, RDFa.VERSION_11)); + RDFParser rdfParser = Rio.createParser(RDFFormat.RDFA); + rdfParser.getParserConfig().set(SemarglParserSettings.RDFA_COMPATIBILITY, RDFa.VERSION_11); + rdfParser.getParserConfig().set(SemarglParserSettings.VOCAB_EXPANSION_ENABLED, true); + rdfParser.getParserConfig().set(SemarglParserSettings.PROCESSOR_GRAPH_ENABLED, true); rdfParser.setRDFHandler(model); rdfParser.parse(input, inputUri); } catch (OpenRDFException e) { // do nothing + // FIXME: Why not fail quickly here? } catch (IOException e) { // do nothing } finally { diff --git a/pom.xml b/pom.xml index 35198bc..91e7689 100644 --- a/pom.xml +++ b/pom.xml @@ -75,7 +75,7 @@ 0.5-incubating 2.7.4 2.9.4 - 2.7.0-beta1 + 2.7.0-beta2 false @@ -196,7 +196,7 @@ **/* **/*.java,**/test/resources/**/*,**/target/**/*,**/maven-repo/**/*, - **/release.properties + **/release.properties,**/.settings,**/.classpath,**/.project . diff --git a/rdfa/src/test/java/org/semarglproject/rdf/rdfa/RdfaTestBundle.java b/rdfa/src/test/java/org/semarglproject/rdf/rdfa/RdfaTestBundle.java index f4679eb..2eed527 100644 --- a/rdfa/src/test/java/org/semarglproject/rdf/rdfa/RdfaTestBundle.java +++ b/rdfa/src/test/java/org/semarglproject/rdf/rdfa/RdfaTestBundle.java @@ -206,7 +206,7 @@ public static void runTestBundle(TestCase testCase, SaveToFileCallback callback, Model resultModel = createModelFromFile(resultFilePath, inputUri); String queryStr = IOUtils.toString(openStreamForResource(testCase.getResult()), "UTF-8"); - assertEquals(askModel(resultModel, queryStr), testCase.getExpectedResult()); + assertEquals(askModel(resultModel, queryStr), testCase.getExpectedResult(), "Test failed: " + inputUri); } catch (IOException e) { fail(); }