### Question:
SpinParser { public SpinParser() { this(Input.TEXT_FIRST); } SpinParser();  SpinParser(Input input);  SpinParser(Input input, Function<IRI, String> wellKnownVarsMapper,
			Function<IRI, String> wellKnownFuncMapper); List<FunctionParser> getFunctionParsers(); void setFunctionParsers(List<FunctionParser> functionParsers); List<TupleFunctionParser> getTupleFunctionParsers(); void setTupleFunctionParsers(List<TupleFunctionParser> tupleFunctionParsers); boolean isStrictFunctionChecking(); void setStrictFunctionChecking(boolean strictFunctionChecking); Map<IRI, RuleProperty> parseRuleProperties(TripleSource store); boolean isThisUnbound(Resource subj, TripleSource store); ConstraintViolation parseConstraintViolation(Resource subj, TripleSource store); ParsedOperation parse(Resource queryResource, TripleSource store); ParsedQuery parseQuery(Resource queryResource, TripleSource store); ParsedGraphQuery parseConstructQuery(Resource queryResource, TripleSource store); ParsedTupleQuery parseSelectQuery(Resource queryResource, TripleSource store); ParsedBooleanQuery parseAskQuery(Resource queryResource, TripleSource store); ParsedDescribeQuery parseDescribeQuery(Resource queryResource, TripleSource store); ParsedUpdate parseUpdate(Resource queryResource, TripleSource store); org.eclipse.rdf4j.query.algebra.evaluation.function.Function parseFunction(IRI funcUri, TripleSource store); TupleFunction parseMagicProperty(IRI propUri, TripleSource store); Map<IRI, Argument> parseArguments(final IRI moduleUri, final TripleSource store); ValueExpr parseExpression(Value expr, TripleSource store); void reset(IRI... uris); static List<IRI> orderArguments(Set<IRI> args);  }### Answer:
@Test public void testSpinParser() throws IOException, RDF4JException { StatementCollector expected = new StatementCollector(); RDFParser parser = Rio.createParser(RDFFormat.TURTLE); parser.setRDFHandler(expected); try (InputStream rdfStream = testURL.openStream()) { parser.parse(rdfStream, testURL.toString()); } Resource queryResource = null; for (Statement stmt : expected.getStatements()) { if (SP.TEXT_PROPERTY.equals(stmt.getPredicate())) { queryResource = stmt.getSubject(); break; } } assertNotNull(queryResource); TripleSource store = new ModelTripleSource(new TreeModel(expected.getStatements())); ParsedOperation textParsedOp = textParser.parse(queryResource, store); ParsedOperation rdfParsedOp = rdfParser.parse(queryResource, store); if (textParsedOp instanceof ParsedQuery) { assertEquals(((ParsedQuery) textParsedOp).getTupleExpr(), ((ParsedQuery) rdfParsedOp).getTupleExpr()); } else { assertEquals(((ParsedUpdate) textParsedOp).getUpdateExprs(), ((ParsedUpdate) rdfParsedOp).getUpdateExprs()); } }
@Test public void testSpinParser() throws IOException, RDF4JException { StatementCollector expected = new StatementCollector(); RDFParser parser = Rio.createParser(RDFFormat.TURTLE); parser.setRDFHandler(expected); try (InputStream rdfStream = testURL.openStream()) { parser.parse(rdfStream, testURL.toString()); } Resource queryResource = null; for (Statement stmt : expected.getStatements()) { if (SP.TEXT_PROPERTY.equals(stmt.getPredicate())) { queryResource = stmt.getSubject(); break; } } assertNotNull(queryResource); TripleSource store = new ModelTripleSource(new TreeModel(expected.getStatements())); ParsedOperation textParsedOp = textParser.parse(queryResource, store); ParsedOperation rdfParsedOp = rdfParser.parse(queryResource, store); if (textParsedOp instanceof ParsedQuery) { assertEquals(((ParsedQuery) textParsedOp).getTupleExpr(), ((ParsedQuery) rdfParsedOp).getTupleExpr()); } else { List<UpdateExpr> textUpdates = ((ParsedUpdate) textParsedOp).getUpdateExprs(); List<UpdateExpr> rdfUpdates = ((ParsedUpdate) rdfParsedOp).getUpdateExprs(); assertThat(textUpdates).isEqualTo(rdfUpdates); } }