You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jena.apache.org by Claude Warren <cl...@xenei.com> on 2014/10/28 20:55:14 UTC
is this a bug?
I think I am doing this correctly but I want to make sure before I open a
bug.
public static void main( final String[] args ) throws Exception
{
String qry = "SELECT (sum(?x) as ?y) WHERE { [] <
http://example.com/int> ?x }";
Model m = ModelFactory.createDefaultModel();
Property d = m.createProperty( "http://example.com/double");
Property i = m.createProperty( "http://example.com/int");
m.add( m.createResource("http://example.com/A"), d, "-1.3" );
m.add( m.createResource("http://example.com/A"), i, "-3" );
m.add( m.createResource("http://example.com/B"), d, "1.5" );
m.add( m.createResource("http://example.com/B"), i, "5" );
m.add( m.createResource("http://example.com/C"), d, "1.7" );
m.add( m.createResource("http://example.com/C"), i, "7" );
Query q = QueryFactory.create(qry);
QueryExecution qexec = QueryExecutionFactory.create(q,m);
final List<QuerySolution> retval = WrappedIterator.create(
qexec.execSelect()).toList();
System.out.println(retval);
}
I would expect the above to return (?x = 9) [ -3+5+7 ]
However with versions 2.12.1, 2.11.0, 2.10.0 and 2.7.4 it returns an empty
result.
Similar errors occur with the abs, round, ceil, and floor functions both
with the integer values (<http://example.com/int>) and the double values (<
http://example.com/double>).
Claude
--
I like: Like Like - The likeliest place on the web
<http://like-like.xenei.com>
LinkedIn: http://www.linkedin.com/in/claudewarren
Re: is this a bug?
Posted by Andy Seaborne <an...@apache.org>.
On 28/10/14 19:55, Claude Warren wrote:
> I think I am doing this correctly but I want to make sure before I open a
> bug.
>
> public static void main( final String[] args ) throws Exception
> {
> String qry = "SELECT (sum(?x) as ?y) WHERE { [] <
> http://example.com/int> ?x }";
> Model m = ModelFactory.createDefaultModel();
> Property d = m.createProperty( "http://example.com/double");
> Property i = m.createProperty( "http://example.com/int");
> m.add( m.createResource("http://example.com/A"), d, "-1.3" );
> m.add( m.createResource("http://example.com/A"), i, "-3" );
> m.add( m.createResource("http://example.com/B"), d, "1.5" );
> m.add( m.createResource("http://example.com/B"), i, "5" );
> m.add( m.createResource("http://example.com/C"), d, "1.7" );
> m.add( m.createResource("http://example.com/C"), i, "7" );
> Query q = QueryFactory.create(qry);
> QueryExecution qexec = QueryExecutionFactory.create(q,m);
> final List<QuerySolution> retval = WrappedIterator.create(
> qexec.execSelect()).toList();
> System.out.println(retval);
> }
>
> I would expect the above to return (?x = 9) [ -3+5+7 ]
>
> However with versions 2.12.1, 2.11.0, 2.10.0 and 2.7.4 it returns an empty
> result.
>
> Similar errors occur with the abs, round, ceil, and floor functions both
> with the integer values (<http://example.com/int>) and the double values (<
> http://example.com/double>).
You have created string literals. "1"+"2" is an error in SPARQL.
Try:
add(Resource s, Property p, String lex, RDFDatatype datatype) ;
Andy
>
> Claude
>
>
>