Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding tests for the gsp:data() function.

  • Loading branch information...
commit f312d28caef856faf0c25597e8da96e746d7a609 1 parent a323053
@philipfennell authored
View
32 src/test/xquery/gsp/data-error-response-from-graph-store.xqy
@@ -0,0 +1,32 @@
+xquery version "1.0-ml" encoding "utf-8";
+
+import module namespace gsp = "http://www.w3.org/TR/sparql11-http-rdf-update/" at
+ "main/xquery/lib-gsp.xqy";
+
+import module namespace test = "http://www.w3.org/TR/sparql11-protocol/test" at
+ "test/resources/xquery/test.xqy";
+
+declare namespace st = "http://www.w3.org/2007/SPARQL/protocol-types#";
+declare namespace error = "http://marklogic.com/xdmp/error";
+
+declare default function namespace "http://www.w3.org/2005/xpath-functions";
+
+let $response as element() :=
+<response status="406" xmlns="http://www.w3.org/Protocols/rfc2616">
+ <header name="server" value="Apache-Coyote/1.1"/>
+ <header name="vary" value="Accept"/>
+ <header name="content-disposition" value="attachment; filename=statements.nt"/>
+ <header name="content-type" value="text/plain;charset=US-ASCII"/>
+ <header name="content-language" value="en-US"/>
+ <header name="date" value="Tue, 10 Apr 2012 10:32:38 GMT"/>
+ <header name="connection" value="close"/>
+ <body content-type="text/plain">No acceptable file format found.</body>
+</response>
+let $result as item() :=
+ try {
+ gsp:data($response)
+ } catch($error) {
+ $error
+ }
+return
+ $result instance of element(error:error)
View
27 src/test/xquery/gsp/data-for-text-serialization.xqy
@@ -0,0 +1,27 @@
+xquery version "1.0-ml" encoding "utf-8";
+
+import module namespace gsp = "http://www.w3.org/TR/sparql11-http-rdf-update/" at
+ "main/xquery/lib-gsp.xqy";
+
+import module namespace test = "http://www.w3.org/TR/sparql11-protocol/test" at
+ "test/resources/xquery/test.xqy";
+
+declare namespace st = "http://www.w3.org/2007/SPARQL/protocol-types#";
+
+declare default function namespace "http://www.w3.org/2005/xpath-functions";
+
+let $response as element() :=
+<response status="200" xmlns="http://www.w3.org/Protocols/rfc2616">
+ <header name="server" value="Apache-Coyote/1.1"/>
+ <header name="vary" value="Accept"/>
+ <header name="content-disposition" value="attachment; filename=statements.nt"/>
+ <header name="content-type" value="text/plain;charset=US-ASCII"/>
+ <header name="content-language" value="en-US"/>
+ <header name="date" value="Tue, 10 Apr 2012 10:32:38 GMT"/>
+ <header name="connection" value="close"/>
+ <body content-type="text/plain">&lt;http://www.w3.org/2001/XMLSchema#string&gt;
+&lt;http://www.w3.org/1999/02/22-rdf-syntax-ns#type&gt;
+&lt;http://www.w3.org/2000/01/rdf-schema#Datatype&gt; .</body>
+</response>
+return
+ gsp:data($response) instance of xs:string
View
33 src/test/xquery/gsp/data-for-xml-serialization.xqy
@@ -0,0 +1,33 @@
+xquery version "1.0-ml" encoding "utf-8";
+
+import module namespace gsp = "http://www.w3.org/TR/sparql11-http-rdf-update/" at
+ "main/xquery/lib-gsp.xqy";
+
+import module namespace test = "http://www.w3.org/TR/sparql11-protocol/test" at
+ "test/resources/xquery/test.xqy";
+
+declare namespace st = "http://www.w3.org/2007/SPARQL/protocol-types#";
+
+declare default function namespace "http://www.w3.org/2005/xpath-functions";
+
+let $response as element() :=
+<response status="200" xmlns="http://www.w3.org/Protocols/rfc2616">
+ <header name="server" value="Apache-Coyote/1.1"/>
+ <header name="vary" value="Accept"/>
+ <header name="content-disposition" value="attachment; filename=statements.rdf"/>
+ <header name="content-type" value="application/rdf+xml;charset=UTF-8"/>
+ <header name="content-language" value="en-US"/>
+ <header name="date" value="Tue, 10 Apr 2012 10:30:02 GMT"/>
+ <header name="connection" value="close"/>
+ <body content-type="application/rdf+xml">
+ <rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
+ xmlns:psys="http://proton.semanticweb.org/protonsys#"
+ xmlns:owl="http://www.w3.org/2002/07/owl#"
+ xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:pext="http://proton.semanticweb.org/protonext#"/>
+ </body>
+</response>
+return
+ gsp:data($response) instance of element()
Please sign in to comment.
Something went wrong with that request. Please try again.