Skip to content

Commit

Permalink
condition to reload data is now based on sys property
Browse files Browse the repository at this point in the history
  • Loading branch information
ddtxra committed May 29, 2015
1 parent 64ffa32 commit a9eedce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
5 changes: 5 additions & 0 deletions default/queries/q0301.rq
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,8 @@ select ?subSpecies where {
# * -> means 0 or more
# + -> means 1 or more
# ? -> means 0 or 1

# The same can be used for any property for example:
# select ?parents where {
# ttr:Eve dbo:parent+ ?parents .
# }
7 changes: 4 additions & 3 deletions default/queries/q0400.rq
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#title:Search for lonely pets and try to find them a nice owner :)

#comment: Insert the triplet using the data tab (you must run the web application locally)
#This query shows pet without owners
#This query shows pets with their owners if it exists
#img:link-data

#dbpedia:Harrison_Ford tto:pet ttr:SnuffMonkey.
select ?pet ?owner where {
?pet a / rdfs:subClassOf+ tto:Animal .
filter not exists {?owner tto:pet ?pet}
}
optional {?owner tto:pet ?pet}
}

Binary file modified sparql-playground.war
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
package ch.isb.sib.sparql.tutorial.controller;

import java.io.IOException;
import java.net.InetAddress;
import java.net.NetworkInterface;
import java.net.SocketException;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
Expand Down Expand Up @@ -49,10 +52,10 @@ public void sparqlData(HttpServletResponse response) throws QueryEvaluationExcep
@RequestMapping(value = "/ttl-data", method = RequestMethod.PUT)
public long sparqlData(@RequestParam(value = "data", required = true) String data, HttpServletRequest request) throws QueryEvaluationException, Exception {

if("localhost".equals(request.getLocalName())){
return sparqlService.loadData(data);
if((System.getProperty("reload") != null) && (System.getProperty("reload").equalsIgnoreCase("false"))){ //check if loading data is not allowed
throw new SparqlTutorialException("You must run the application in localhost in order to load data. Download it by clicking on the link below the page");
}else {
throw new SparqlTutorialException("You must run the application in localhost in order to load data. Download it on GitHub by following the link 'For Developers'");
return sparqlService.loadData(data);
}
}

Expand Down

0 comments on commit a9eedce

Please sign in to comment.