Strabon
changeset 1316:6e2c60cee963
Added a boolean variable to stSPARQLResultsHTMLWriter.java so that results in queries that are links can either go to web link or be described. We must check if its possible to move that variable in the beans.xml
author | George Stamoulis <gstam@di.uoa.gr> |
---|---|
date | Mon Mar 17 20:26:19 2014 +0200 (2014-03-17) |
parents | 9bfbe553dfec |
children | 408982a81ac1 |
files | endpoint/WebContent/WEB-INF/beans.xml resultio-spatial/sparqlhtml/src/main/java/org/openrdf/query/resultio/sparqlhtml/stSPARQLResultsHTMLWriter.java |
line diff
1.1 --- a/endpoint/WebContent/WEB-INF/beans.xml Mon Mar 17 13:48:53 2014 +0200 1.2 +++ b/endpoint/WebContent/WEB-INF/beans.xml Mon Mar 17 20:26:19 2014 +0200 1.3 @@ -72,6 +72,8 @@ 1.4 <!-- Load from File --> 1.5 <value>true</value> 1.6 </constructor-arg> 1.7 + 1.8 + <!-- Boolean variable linkURL in stSPARQLResultsHTMLWriter.java (line 115) to change the links between web and describe --> 1.9 1.10 <constructor-arg type="java.lang.String" > 1.11 <!-- Default prefixes -->
2.1 --- a/resultio-spatial/sparqlhtml/src/main/java/org/openrdf/query/resultio/sparqlhtml/stSPARQLResultsHTMLWriter.java Mon Mar 17 13:48:53 2014 +0200 2.2 +++ b/resultio-spatial/sparqlhtml/src/main/java/org/openrdf/query/resultio/sparqlhtml/stSPARQLResultsHTMLWriter.java Mon Mar 17 20:26:19 2014 +0200 2.3 @@ -110,6 +110,12 @@ 2.4 try { 2.5 StringBuilder value = new StringBuilder(); 2.6 Value boundValue = null; 2.7 + String href; 2.8 + 2.9 + // if set to FALSE, urls link to web. if set to TRUE, urls are described // 2.10 + boolean linkURL = false; 2.11 + /////////////////////////////////////////////////////////////////////////// 2.12 + 2.13 2.14 xmlWriter.startTag(TABLE_ROW_TAG); 2.15 for (String bindingName : bindingNames) { 2.16 @@ -130,7 +136,8 @@ 2.17 xmlWriter.startTag(TABLE_DATA_TAG); 2.18 2.19 // select all the triples that contain the boundValue 2.20 - String query= "select * " + 2.21 + if (linkURL){ 2.22 + String query= "select * " + 2.23 "where " + 2.24 "{ " + 2.25 "?subject ?predicate ?object . "+ 2.26 @@ -138,8 +145,12 @@ 2.27 "(?predicate = <"+ boundValue.toString()+ ">) || "+ 2.28 "(?object = <"+ boundValue.toString()+ ">)) " + 2.29 "}"; 2.30 - 2.31 - String href = "Browse?view=HTML&query="+URLEncoder.encode(query, "UTF-8")+"&format=HTML&resource="+URLEncoder.encode(boundValue.toString(), "UTF-8"); 2.32 + href = "Browse?view=HTML&query="+URLEncoder.encode(query, "UTF-8")+"&format=HTML&resource="+URLEncoder.encode(boundValue.toString(), "UTF-8"); 2.33 + } 2.34 + else{ 2.35 + System.out.println("url:"+ boundValue.toString()); 2.36 + href = boundValue.toString(); 2.37 + } 2.38 xmlWriter.setAttribute(LINK_REF, href); 2.39 xmlWriter.startTag(LINK); 2.40 xmlWriter.text(boundValue.toString());