Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions sparql/sparql11/functions/abs-float.rq
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
PREFIX : <http://example.org/>
SELECT ?s (ABS(?num) AS ?v) WHERE {
?s :num ?num
}
37 changes: 37 additions & 0 deletions sparql/sparql11/functions/abs-float.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
<variable name="v"/>
</head>
<results>
<result>
<binding name="s"><uri>http://example.org/n1</uri></binding>
<binding name="v"><literal datatype="http://www.w3.org/2001/XMLSchema#float">0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n2</uri></binding>
<binding name="v"><literal datatype="http://www.w3.org/2001/XMLSchema#double">0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n3</uri></binding>
<binding name="v"><literal datatype="http://www.w3.org/2001/XMLSchema#float">0.1</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n4</uri></binding>
<binding name="v"><literal datatype="http://www.w3.org/2001/XMLSchema#double">0.1</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n5</uri></binding>
<binding name="v"><literal datatype="http://www.w3.org/2001/XMLSchema#double">NaN</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n6</uri></binding>
<binding name="v"><literal datatype="http://www.w3.org/2001/XMLSchema#float">INF</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n7</uri></binding>
<binding name="v"><literal datatype="http://www.w3.org/2001/XMLSchema#double">INF</literal></binding>
</result>
</results>
</sparql>
45 changes: 45 additions & 0 deletions sparql/sparql11/functions/ceil-float.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
<variable name="num"/>
<variable name="ceil"/>
</head>
<results>
<result>
<binding name="s"><uri>http://example.org/n1</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">0</literal></binding>
<binding name="ceil"><literal datatype="http://www.w3.org/2001/XMLSchema#float">0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n2</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">-0</literal></binding>
<binding name="ceil"><literal datatype="http://www.w3.org/2001/XMLSchema#double">-0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n3</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-0.1</literal></binding>
<binding name="ceil"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n4</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">0.1</literal></binding>
<binding name="ceil"><literal datatype="http://www.w3.org/2001/XMLSchema#double">1</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n5</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">NaN</literal></binding>
<binding name="ceil"><literal datatype="http://www.w3.org/2001/XMLSchema#double">NaN</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n6</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-INF</literal></binding>
<binding name="ceil"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-INF</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n7</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">INF</literal></binding>
<binding name="ceil"><literal datatype="http://www.w3.org/2001/XMLSchema#double">INF</literal></binding>
</result>
</results>
</sparql>
10 changes: 10 additions & 0 deletions sparql/sparql11/functions/data-float.ttl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix : <http://example.org/> .

:n1 :num "0"^^xsd:float .
:n2 :num "-0"^^xsd:double .
:n3 :num "-0.1"^^xsd:float .
:n4 :num "0.1"^^xsd:double .
:n5 :num "NaN"^^xsd:double .
:n6 :num "-INF"^^xsd:float .
:n7 :num "INF"^^xsd:double .
45 changes: 45 additions & 0 deletions sparql/sparql11/functions/floor-float.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="utf-8"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
<variable name="num"/>
<variable name="floor"/>
</head>
<results>
<result>
<binding name="s"><uri>http://example.org/n1</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">0</literal></binding>
<binding name="floor"><literal datatype="http://www.w3.org/2001/XMLSchema#float">0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n2</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">-0</literal></binding>
<binding name="floor"><literal datatype="http://www.w3.org/2001/XMLSchema#double">-0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n3</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-0.1</literal></binding>
<binding name="floor"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-1</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n4</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">0.1</literal></binding>
<binding name="floor"><literal datatype="http://www.w3.org/2001/XMLSchema#double">0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n5</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">NaN</literal></binding>
<binding name="floor"><literal datatype="http://www.w3.org/2001/XMLSchema#double">NaN</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n6</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-INF</literal></binding>
<binding name="floor"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-INF</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n7</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">INF</literal></binding>
<binding name="floor"><literal datatype="http://www.w3.org/2001/XMLSchema#double">INF</literal></binding>
</result>
</results>
</sparql>
125 changes: 125 additions & 0 deletions sparql/sparql11/functions/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,31 @@ <h2>
</dd>
</dl>
</dd>
<dt id='isnumeric-float'>
<a class='testlink' href='#isnumeric-float'>
isnumeric-float:
</a>
<span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#isnumeric-float' property='mf:name'>isNumeric() on float and double</span>
</dt>
<dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#isnumeric-float' typeof='mf:QueryEvaluationTest'>
<div property='rdfs:comment'>
</div>
<dl class='test-detail'>
<dt>type</dt>
<dd>mf:QueryEvaluationTest</dd>
<dt>approval</dt>
<dd property='mf:approval' resource=''></dd>
<dt>action</dt>
<dd>
<dl class='test-detail' property='mf:action' resource=''>
</dl>
</dd>
<dt>result</dt>
<dd>
<a href='isnumeric-float.srx' property='mf:result'>isnumeric-float.srx</a>
</dd>
</dl>
</dd>
<dt id='abs01'>
<a class='testlink' href='#abs01'>
abs01:
Expand All @@ -277,6 +302,31 @@ <h2>
</dd>
</dl>
</dd>
<dt id='abs-float'>
<a class='testlink' href='#abs-float'>
abs-float:
</a>
<span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#abs-float' property='mf:name'>ABS() on float and double</span>
</dt>
<dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#abs-float' typeof='mf:QueryEvaluationTest'>
<div property='rdfs:comment'>
</div>
<dl class='test-detail'>
<dt>type</dt>
<dd>mf:QueryEvaluationTest</dd>
<dt>approval</dt>
<dd property='mf:approval' resource=''></dd>
<dt>action</dt>
<dd>
<dl class='test-detail' property='mf:action' resource=''>
</dl>
</dd>
<dt>result</dt>
<dd>
<a href='abs-float.srx' property='mf:result'>abs-float.srx</a>
</dd>
</dl>
</dd>
<dt id='ceil01'>
<a class='testlink' href='#ceil01'>
ceil01:
Expand All @@ -302,6 +352,31 @@ <h2>
</dd>
</dl>
</dd>
<dt id='ceil-float'>
<a class='testlink' href='#ceil-float'>
ceil-float:
</a>
<span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#ceil-float' property='mf:name'>CEIL() on float and double</span>
</dt>
<dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#ceil-float' typeof='mf:QueryEvaluationTest'>
<div property='rdfs:comment'>
</div>
<dl class='test-detail'>
<dt>type</dt>
<dd>mf:QueryEvaluationTest</dd>
<dt>approval</dt>
<dd property='mf:approval' resource=''></dd>
<dt>action</dt>
<dd>
<dl class='test-detail' property='mf:action' resource=''>
</dl>
</dd>
<dt>result</dt>
<dd>
<a href='ceil-float.srx' property='mf:result'>ceil-float.srx</a>
</dd>
</dl>
</dd>
<dt id='floor01'>
<a class='testlink' href='#floor01'>
floor01:
Expand All @@ -327,6 +402,31 @@ <h2>
</dd>
</dl>
</dd>
<dt id='floor-float'>
<a class='testlink' href='#floor-float'>
floor-float:
</a>
<span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#floor-float' property='mf:name'>FLOOR() on float and double</span>
</dt>
<dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#floor-float' typeof='mf:QueryEvaluationTest'>
<div property='rdfs:comment'>
</div>
<dl class='test-detail'>
<dt>type</dt>
<dd>mf:QueryEvaluationTest</dd>
<dt>approval</dt>
<dd property='mf:approval' resource=''></dd>
<dt>action</dt>
<dd>
<dl class='test-detail' property='mf:action' resource=''>
</dl>
</dd>
<dt>result</dt>
<dd>
<a href='floor-float.srx' property='mf:result'>floor-float.srx</a>
</dd>
</dl>
</dd>
<dt id='round01'>
<a class='testlink' href='#round01'>
round01:
Expand All @@ -352,6 +452,31 @@ <h2>
</dd>
</dl>
</dd>
<dt id='round-float'>
<a class='testlink' href='#round-float'>
round-float:
</a>
<span about='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#round-float' property='mf:name'>ROUND() on float and double</span>
</dt>
<dd inlist='true' property='mf:entry' resource='http://www.w3.org/2009/sparql/docs/tests/data-sparql11/functions/manifest#round-float' typeof='mf:QueryEvaluationTest'>
<div property='rdfs:comment'>
</div>
<dl class='test-detail'>
<dt>type</dt>
<dd>mf:QueryEvaluationTest</dd>
<dt>approval</dt>
<dd property='mf:approval' resource=''></dd>
<dt>action</dt>
<dd>
<dl class='test-detail' property='mf:action' resource=''>
</dl>
</dd>
<dt>result</dt>
<dd>
<a href='round-float.srx' property='mf:result'>round-float.srx</a>
</dd>
</dl>
</dd>
<dt id='concat01'>
<a class='testlink' href='#concat01'>
concat01:
Expand Down
37 changes: 37 additions & 0 deletions sparql/sparql11/functions/isnumeric-float.srx
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<sparql xmlns="http://www.w3.org/2005/sparql-results#">
<head>
<variable name="s"/>
<variable name="num"/>
</head>
<results>
<result>
<binding name="s"><uri>http://example.org/n1</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n2</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">-0</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n3</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-0.1</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n4</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">0.1</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n5</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">NaN</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n6</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#float">-INF</literal></binding>
</result>
<result>
<binding name="s"><uri>http://example.org/n7</uri></binding>
<binding name="num"><literal datatype="http://www.w3.org/2001/XMLSchema#double">INF</literal></binding>
</result>
</results>
</sparql>
Loading