From: <tho...@us...> - 2012-12-12 19:15:33
|
Revision: 6765 http://bigdata.svn.sourceforge.net/bigdata/?rev=6765&view=rev Author: thompsonbry Date: 2012-12-12 19:15:23 +0000 (Wed, 12 Dec 2012) Log Message: ----------- Added support for issueing queries and update requests against non-default KBs from the NSS index.html page. Modified Paths: -------------- branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/BigdataRDFContext.java branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/BigdataRDFServlet.java branches/BIGDATA_RELEASE_1_2_0/bigdata-war/src/html/index.html Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/BigdataRDFContext.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/BigdataRDFContext.java 2012-12-12 17:53:16 UTC (rev 6764) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/BigdataRDFContext.java 2012-12-12 19:15:23 UTC (rev 6765) @@ -188,6 +188,15 @@ */ protected static final String USING_NAMED_GRAPH_URI = "using-named-graph-uri"; + /** + * URL query parameter used to specify a non-default KB namespace (as an + * alternative to having it in the URL path). The path takes precendence + * over this query parameter. + * + * @see BigdataRDFServlet#getNamespace(HttpServletRequest) + */ + protected static final String NAMESPACE = "namespace"; + private final SparqlEndpointConfig m_config; /** Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/BigdataRDFServlet.java =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/BigdataRDFServlet.java 2012-12-12 17:53:16 UTC (rev 6764) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata-sails/src/java/com/bigdata/rdf/sail/webapp/BigdataRDFServlet.java 2012-12-12 19:15:23 UTC (rev 6765) @@ -267,6 +267,21 @@ if (snmsp == -1) { + String s = req.getParameter(BigdataRDFContext.NAMESPACE); + + if (s != null) { + + s = s.trim(); + + if (s.length() > 0) { + + // Specified as a query parameter. + return s; + + } + + } + // use the default namespace. return getConfig().namespace; Modified: branches/BIGDATA_RELEASE_1_2_0/bigdata-war/src/html/index.html =================================================================== --- branches/BIGDATA_RELEASE_1_2_0/bigdata-war/src/html/index.html 2012-12-12 17:53:16 UTC (rev 6764) +++ branches/BIGDATA_RELEASE_1_2_0/bigdata-war/src/html/index.html 2012-12-12 19:15:23 UTC (rev 6765) @@ -40,11 +40,15 @@ use GET for database queries since they are, by and large, idempotent. --> <h2><a href="http://www.w3.org/TR/sparql11-query/"> SPARQL Query </a></h2> -<FORM action="sparql" method="post"> +<FORM action="sparql" method="post" name="QUERY"> <P> <TEXTAREA name="query" rows="10" cols="80" title="Enter SPARQL Query." >SELECT * { ?s ?p ?o } LIMIT 1</TEXTAREA> </P><P> + Tenant Namespace + <INPUT type="text" name="namespace" title="Tenant namespace." + > (leave empty for default KB) + </P><P> <INPUT type="submit" value="Send" title="Submit query."> <INPUT type="checkbox" name="explain" value="true" title="Explain query plan rather than returning the query results." @@ -70,6 +74,10 @@ dc:creator "A.N.Other" . }</TEXTAREA> </P><P> + Tenant Namespace + <INPUT type="text" name="namespace" title="Tenant namespace." + > (leave empty for default KB) + </P><P> <INPUT type="submit" value="Send" title="Submit Update."> <!--INPUT type="checkbox" name="explain" value="true" title="Explain query plan rather than returning the query results." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |