Skip to content
Open
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
111 changes: 111 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
<relativePath />
</parent>

<packaging>jar</packaging>
<groupId>org.webjars</groupId>
<artifactId>snorql</artifactId>
<version>1.0.0</version>
<name>SNORQL Sparql Explorer</name>
<description>WebJar for SNORQL</description>
<url>https://github.com/kurtjx/SNORQL</url>

<developers>
<developer>
<id>kurtjx</id>
<url>https://github.com/kurtjx</url>
</developer>
<developer>
<name>Richard Cyganaik</name>
<url>http://richard.cyganiak.de/</url>
</developer>
</developers>

<contributors>
<contributor>
<name>Jakob Frank</name>
<email>jakob.frank@salzburgresearch.at</email>
<url>https://github.com/ja-fra</url>
<organization>Salzburg Research Forschungsges.m.b.H</organization>
<organizationUrl>http://www.salzburgresearch.at/</organizationUrl>
</contributor>
</contributors>

<licenses>
<license>
<name>Apache-2 license</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>

<scm>
<url>http://github.com/kurtjx/SNORQL</url>
<connection>scm:git:https://github.com/kurtjx/SNORQL.git</connection>
<developerConnection>scm:git:https://github.com/kurtjx/SNORQL.git</developerConnection>
<tag>HEAD</tag>
</scm>

<dependencies>
</dependencies>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<destDir>${project.build.outputDirectory}/META-INF/resources/webjars/${project.artifactId}/${project.version}</destDir>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.scm</groupId>
<artifactId>maven-scm-provider-gitexe</artifactId>
<version>1.9</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.5.1</version>
<extensions>true</extensions>
<configuration>
<serverId>sonatype-nexus-staging</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.basedir}/snorql</directory>
<targetPath>${destDir}</targetPath>
<filtering>false</filtering>
</resource>
<resource>
<directory>${project.basedir}</directory>
<targetPath>${project.build.outputDirectory}/META-INF</targetPath>
<filtering>false</filtering>
<includes>
<include>README</include>
<include>LICENSE</include>
</includes>
</resource>
</resources>
</build>

</project>
3 changes: 3 additions & 0 deletions snorql/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<script type="text/javascript" src="sparql.js"></script>
<script type="text/javascript" src="namespaces.js"></script>
<script type="text/javascript" src="snorql.js"></script>
<script type="text/javascript">
var snorql = new Snorql({'endpoint': document.location.href.match(/^([^?]*)snorql\//)[1] + 'sparql'});
</script>
</head>

<body class="snorql" onload="snorql.start()">
Expand Down
34 changes: 21 additions & 13 deletions snorql/snorql.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
var snorql = new Snorql();

String.prototype.trim = function () {
return this.replace(/^\s*/, "").replace(/\s*$/, "");
Expand All @@ -8,25 +7,26 @@ String.prototype.startsWith = function(str) {
return (this.match("^"+str) == str);
}

function Snorql() {
// modify this._endpoint to point to your SPARQL endpoint
this._endpoint = document.location.href.match(/^([^?]*)snorql\//)[1] + 'sparql';
// modify these to your likeing
this._poweredByLink = 'http://www4.wiwiss.fu-berlin.de/bizer/d2r-server/';
this._poweredByLabel = 'D2R Server';
this._enableNamedGraphs = false;
function Snorql(options) {
options = options || {};

this._browserBase = null;
this._namespaces = {};
this._graph = null;
this._xsltDOM = null;
this._endpoint = options['endpoint'] || undefined;

this._poweredByLink = options['poweredByLink'] || 'http://www4.wiwiss.fu-berlin.de/bizer/d2r-server/';
this._poweredByLabel = options['poweredByLabel'] || 'D2R Server';
this._enableNamedGraphs = options['enableNamedGraphs'] || false;

this._browserBase = options['browserBase'] || null;
this._namespaces = options['namespaces'] || D2R_namespacePrefixes;
this._graph = options['graph'] || null;
this._xsltDOM = options['xsltDOM'] || null;

this.start = function() {
// TODO: Extract a QueryType class
this.setBrowserBase(document.location.href.replace(/\?.*/, ''));
this._displayEndpointURL();
this._displayPoweredBy();
this.setNamespaces(D2R_namespacePrefixes);
this.setNamespaces(this._namespaces);
this.updateOutputMode();
var match = document.location.href.match(/\?(.*)/);
var queryString = match ? match[1] : '';
Expand Down Expand Up @@ -104,6 +104,10 @@ function Snorql() {
}
document.getElementById('querytext').value = querytext;
this.displayBusyMessage();
if (!this._endpoint) {
this.displayErrorMessage("No SPARQL Endpoint provided!");
return;
}
var service = new SPARQL.Service(this._endpoint);
if (this._graph) {
service.addDefaultGraph(this._graph);
Expand Down Expand Up @@ -232,6 +236,10 @@ function Snorql() {
}

this.submitQuery = function() {
if (!this._endpoint) {
this.displayErrorMessage("No SPARQL Endpoint defined!");
}

var mode = this._selectedOutputMode();
if (mode == 'browse') {
document.getElementById('queryform').action = this._browserBase;
Expand Down