You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@clerezza.apache.org by "Hasan (JIRA)" <ji...@apache.org> on 2009/12/15 13:57:18 UTC

[jira] Resolved: (CLEREZZA-33) serialization of sparql query containing filter with regex fails

     [ https://issues.apache.org/jira/browse/CLEREZZA-33?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Hasan resolved CLEREZZA-33.
---------------------------

    Resolution: Fixed

> 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
>            Assignee: 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.