incubator-clerezza-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Hasan (JIRA)" <j...@apache.org>
Subject [jira] Created: (CLEREZZA-33) serialization of sparql query containing filter with regex fails
Date Tue, 15 Dec 2009 12:39:18 GMT
serialization of sparql query containing filter with regex fails
----------------------------------------------------------------

                 Key: CLEREZZA-33
                 URL: https://issues.apache.org/jira/browse/CLEREZZA-33
             Project: Clerezza
          Issue Type: Bug
            Reporter: Hasan


The following test fails

	@Test
	public void testRegex() {

		final String queryString = "SELECT ?p WHERE { " +
				"<http://localhost/testitem> ?p ?x . " +
				"FILTER REGEX(?x,\".*uni.*\"^^<http://www.w3.org/2001/XMLSchema#string>) }";

		Variable p = new Variable("p");
		SimpleSelectQuery selectQuery = new SimpleSelectQuery();
		selectQuery.addSelection(p);

		Variable x = new Variable("x");
		Set<TriplePattern> triplePatterns = new HashSet<TriplePattern>();
		triplePatterns.add(new SimpleTriplePattern(
				new UriRef("http://localhost/testitem"), p, x));

		SimpleBasicGraphPattern bgp = new SimpleBasicGraphPattern(triplePatterns);
		SimpleGroupGraphPattern queryPattern = new SimpleGroupGraphPattern();
		queryPattern.addGraphPattern(bgp);

		List<Expression> arguments = new ArrayList<Expression>();
		arguments.add(x);
		arguments.add(new LiteralExpression(LiteralFactory.getInstance().
				createTypedLiteral(".*uni.*")));
		BuiltInCall constraint = new BuiltInCall("REGEX", arguments);
		queryPattern.addConstraint(constraint);
		selectQuery.setQueryPattern(queryPattern);
		Assert.assertTrue(selectQuery.toString()
				.replaceAll("( |\n)+", " ").trim().equals(queryString));
	}



-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message