You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@marmotta.apache.org by ss...@apache.org on 2013/02/22 16:21:36 UTC
[34/37] MARMOTTA-105: refactoring of packages in remaining platform
modules
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java b/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java
deleted file mode 100644
index f64327d..0000000
--- a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/SPARQLBooleanHTMLWriter.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.newmedialab.lmf.sparql.services.sparqlio.sparqlhtml;
-
-import org.apache.marmotta.platform.core.api.config.ConfigurationService;
-import org.apache.marmotta.platform.core.util.KiWiContext;
-import org.jdom2.Document;
-import org.jdom2.output.Format;
-import org.jdom2.output.XMLOutputter;
-import org.jdom2.transform.JDOMResult;
-import org.openrdf.query.resultio.BooleanQueryResultFormat;
-import org.openrdf.query.resultio.BooleanQueryResultWriter;
-import org.openrdf.query.resultio.sparqlxml.SPARQLBooleanXMLWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamSource;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.charset.Charset;
-
-/**
- * Add file description here!
- * <p/>
- * User: sschaffe
- */
-public class SPARQLBooleanHTMLWriter implements BooleanQueryResultWriter {
-
- private static final Logger log = LoggerFactory.getLogger(SPARQLBooleanHTMLWriter.class);
-
- private OutputStream out;
- private ByteArrayOutputStream xmlOut;
-
- private SPARQLBooleanXMLWriter xmlWriter;
-
- private Templates stylesheet;
-
- public SPARQLBooleanHTMLWriter(OutputStream out) {
- this.out = out;
- this.xmlOut = new ByteArrayOutputStream();
- this.xmlWriter = new SPARQLBooleanXMLWriter(xmlOut);
-
- Source s_stylesheet = new StreamSource(SPARQLBooleanHTMLWriter.class.getResourceAsStream("style.xsl"));
- try {
- stylesheet = TransformerFactory.newInstance().newTemplates(s_stylesheet);
- } catch (TransformerConfigurationException e) {
- log.error("could not compile stylesheet for rendering SPARQL results; result display not available!");
- }
- }
-
- /**
- * Gets the query result format that this writer uses.
- */
- @Override
- public BooleanQueryResultFormat getBooleanQueryResultFormat() {
- return new BooleanQueryResultFormat("SPARQL/HTML","text/html", Charset.forName("UTF-8"), "html");
- }
-
- /**
- * Writes the specified boolean value.
- */
- @Override
- public void write(boolean value) throws IOException {
- xmlWriter.write(value);
-
- byte[] queryResult = xmlOut.toByteArray();
-
- // get server uri
- String server_uri = KiWiContext.getInstance(ConfigurationService.class).getServerUri();
-
- BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
- try {
- Source input = new StreamSource(new ByteArrayInputStream(queryResult));
-
-
- Transformer transformer = stylesheet.newTransformer();
- transformer.setParameter("serverurl", server_uri);
-
- JDOMResult result = new JDOMResult();
- transformer.transform(input,result);
- Document output = result.getDocument();
-
- XMLOutputter printer = new XMLOutputter(Format.getPrettyFormat());
- printer.output(output, writer);
- writer.flush();
- } catch (Exception ex) {
- throw new IOException("error while transforming XML results to HTML",ex);
- } finally {
- writer.close();
- }
-
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java b/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java
deleted file mode 100644
index 73d9d3a..0000000
--- a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/SPARQLResultsHTMLWriter.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.newmedialab.lmf.sparql.services.sparqlio.sparqlhtml;
-
-import org.apache.marmotta.platform.core.api.config.ConfigurationService;
-import org.apache.marmotta.platform.core.util.KiWiContext;
-import org.jdom2.Document;
-import org.jdom2.output.Format;
-import org.jdom2.output.XMLOutputter;
-import org.jdom2.transform.JDOMResult;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.TupleQueryResultHandlerException;
-import org.openrdf.query.resultio.TupleQueryResultFormat;
-import org.openrdf.query.resultio.TupleQueryResultWriter;
-import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.xml.transform.Source;
-import javax.xml.transform.Templates;
-import javax.xml.transform.Transformer;
-import javax.xml.transform.TransformerConfigurationException;
-import javax.xml.transform.TransformerFactory;
-import javax.xml.transform.stream.StreamSource;
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.nio.charset.Charset;
-import java.util.List;
-
-/**
- * Add file description here!
- * <p/>
- * User: sschaffe
- */
-public class SPARQLResultsHTMLWriter implements TupleQueryResultWriter {
-
- private static final Logger log = LoggerFactory.getLogger(SPARQLResultsHTMLWriter.class);
-
- private OutputStream out;
- private ByteArrayOutputStream xmlOut;
-
- private SPARQLResultsXMLWriter xmlWriter;
-
- private Templates stylesheet;
-
- public SPARQLResultsHTMLWriter(OutputStream out) {
- this.out = out;
- this.xmlOut = new ByteArrayOutputStream();
- this.xmlWriter = new SPARQLResultsXMLWriter(xmlOut);
- Source s_stylesheet = new StreamSource(SPARQLResultsHTMLWriter.class.getResourceAsStream("style.xsl"));
- try {
- stylesheet = TransformerFactory.newInstance().newTemplates(s_stylesheet);
- } catch (TransformerConfigurationException e) {
- log.error("could not compile stylesheet for rendering SPARQL results; result display not available!");
- }
- }
-
-
- /**
- * Gets the query result format that this writer uses.
- */
- @Override
- public TupleQueryResultFormat getTupleQueryResultFormat() {
- return new TupleQueryResultFormat("SPARQL/HTML","text/html", Charset.forName("UTF-8"), "html");
- }
-
- /**
- * Indicates the start of a sequence of Solutions. The supplied bindingNames
- * are an indication of the values that are in the Solutions. For example, a
- * SeRQL query like <tt>select X, Y from {X} P {Y} </tt> will have binding
- * names <tt>X</tt> and <tt>Y</tt>.
- *
- * @param bindingNames An ordered set of binding names.
- */
- @Override
- public void startQueryResult(List<String> bindingNames) throws TupleQueryResultHandlerException {
- xmlWriter.startQueryResult(bindingNames);
- }
-
- /**
- * Indicates the end of a sequence of solutions.
- */
- @Override
- public void endQueryResult() throws TupleQueryResultHandlerException {
- xmlWriter.endQueryResult();
-
- // get server uri
- String server_uri = KiWiContext.getInstance(ConfigurationService.class).getServerUri();
-
- byte[] queryResult = xmlOut.toByteArray();
-
- BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(out));
- try {
- Source input = new StreamSource(new ByteArrayInputStream(queryResult));
-
- Transformer transformer = stylesheet.newTransformer();
- transformer.setParameter("serverurl", server_uri);
-
- JDOMResult result = new JDOMResult();
- transformer.transform(input,result);
- Document output = result.getDocument();
-
- XMLOutputter printer = new XMLOutputter(Format.getPrettyFormat());
- printer.output(output, writer);
- writer.flush();
-
- } catch (Exception ex) {
- throw new TupleQueryResultHandlerException("error while transforming XML results to HTML",ex);
- } finally {
- try {
- writer.close();
- } catch (IOException e) {}
- }
-
- }
-
- /**
- * Handles a solution.
- */
- @Override
- public void handleSolution(BindingSet bindingSet) throws TupleQueryResultHandlerException {
- xmlWriter.handleSolution(bindingSet);
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/style.xsl
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/style.xsl b/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/style.xsl
deleted file mode 100644
index 2160794..0000000
--- a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqlhtml/style.xsl
+++ /dev/null
@@ -1,193 +0,0 @@
-<?xml version="1.0"?>
-<!--
-
- Copyright (C) 2013 Salzburg Research.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
-
--->
-<xsl:stylesheet version="1.0"
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
- xmlns="http://www.w3.org/1999/xhtml"
- xmlns:res="http://www.w3.org/2005/sparql-results#"
- exclude-result-prefixes="res xsl">
-
- <!--
- <xsl:output
- method="html"
- media-type="text/html"
- doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"
- indent="yes"
- encoding="UTF-8"/>
- -->
-
- <!-- or this? -->
-
- <xsl:output
- method="xml"
- indent="yes"
- encoding="UTF-8"
- doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
- doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
- omit-xml-declaration="no" />
-
- <xsl:param name="serverurl" select="'http://localhost:8080/LMF/'"/>
-
- <xsl:template name="header">
- <div>
- <h2>Header</h2>
- <xsl:for-each select="res:head/res:link">
- <p>Link to <xsl:value-of select="@href"/></p>
- </xsl:for-each>
- </div>
- </xsl:template>
-
- <xsl:template name="boolean-result">
- <div>
- <!--
- <h2>Boolean Result</h2>
- -->
- <p>ASK => <xsl:value-of select="res:boolean"/></p>
- </div>
- </xsl:template>
-
-
- <xsl:template name="vb-result">
- <div>
- <!--
- <h2>Variable Bindings Result</h2>
- <p>Ordered: <xsl:value-of select="res:results/@ordered"/></p>
- <p>Distinct: <xsl:value-of select="res:results/@distinct"/></p>
- -->
-
- <table>
- <xsl:text>
- </xsl:text>
- <tr style="background-color: #006D8F;color: white;">
- <xsl:for-each select="res:head/res:variable">
- <th><xsl:value-of select="@name"/></th>
- </xsl:for-each>
- </tr>
- <xsl:text>
- </xsl:text>
- <xsl:for-each select="res:results/res:result">
- <xsl:choose>
- <xsl:when test="(position() mod 2) = 0">
- <tr style="background-color:lightblue;">
- <xsl:apply-templates select="."/>
- </tr>
- </xsl:when>
- <xsl:otherwise>
- <tr style="background-color:#DFF7FF;">
- <xsl:apply-templates select="."/>
- </tr>
- </xsl:otherwise>
- </xsl:choose>
- </xsl:for-each>
- </table>
- </div>
- </xsl:template>
-
- <xsl:template match="res:result">
- <xsl:variable name="current" select="."/>
- <xsl:for-each select="//res:head/res:variable">
- <xsl:variable name="name" select="@name"/>
- <td>
- <xsl:choose>
- <xsl:when test="$current/res:binding[@name=$name]">
- <!-- apply template for the correct value type (bnode, uri, literal) -->
- <xsl:apply-templates select="$current/res:binding[@name=$name]"/>
- </xsl:when>
- <xsl:otherwise>
- <!-- no binding available for this variable in this solution -->
- </xsl:otherwise>
- </xsl:choose>
- </td>
- </xsl:for-each>
- </xsl:template>
-
- <xsl:template match="res:bnode">
- <xsl:text>_:</xsl:text>
- <xsl:value-of select="text()"/>
- </xsl:template>
-
- <xsl:template match="res:uri">
- <xsl:variable name="uri" select="text()"/>
- <a href="{$serverurl}resource?uri={$uri}">
- <xsl:text><</xsl:text>
- <xsl:value-of select="$uri"/>
- <xsl:text>></xsl:text>
- </a>
- </xsl:template>
-
- <xsl:template match="res:literal">
- <xsl:text>"</xsl:text>
- <xsl:value-of select="text()"/>
- <xsl:text>"</xsl:text>
-
- <xsl:choose>
- <xsl:when test="@datatype">
- <!-- datatyped literal value -->
- ^^<<xsl:value-of select="@datatype"/>>
- </xsl:when>
- <xsl:when test="@xml:lang">
- <!-- lang-string -->
- @<xsl:value-of select="@xml:lang"/>
- </xsl:when>
- </xsl:choose>
- </xsl:template>
-
- <xsl:template match="res:sparql">
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta>
- <title>SPARQL Query Results</title>
- <style>
- <![CDATA[
- h1 { font-size: 150% ; }
- h2 { font-size: 125% ; }
- table { border-collapse: collapse ; border: 2px solid white ; }
- td, th
- { border: 2px solid white ;
- padding-left:0.5em; padding-right: 0.5em;
- padding-top:0.2ex ; padding-bottom:0.2ex
- }
-
- ]]>
- </style>
- </head>
- <body>
-
-
- <h1>SPARQL Query Results</h1>
-
- <xsl:if test="res:head/res:link">
- <xsl:call-template name="header"/>
- </xsl:if>
-
- <xsl:choose>
- <xsl:when test="res:boolean">
- <xsl:call-template name="boolean-result" />
- </xsl:when>
-
- <xsl:when test="res:results">
- <xsl:call-template name="vb-result" />
- </xsl:when>
-
- </xsl:choose>
-
-
- </body>
- </html>
- </xsl:template>
-</xsl:stylesheet>
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java b/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java
deleted file mode 100644
index 1fd3b01..0000000
--- a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqljson/SPARQLBooleanJSONWriter.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.newmedialab.lmf.sparql.services.sparqlio.sparqljson;
-
-import org.openrdf.query.resultio.BooleanQueryResultFormat;
-import org.openrdf.query.resultio.BooleanQueryResultWriter;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.nio.charset.Charset;
-
-/**
- * Add file description here!
- * <p/>
- * User: sschaffe
- */
-public class SPARQLBooleanJSONWriter implements BooleanQueryResultWriter {
-
-
- private OutputStream out;
-
- public SPARQLBooleanJSONWriter(OutputStream out) {
- this.out = out;
- }
-
- /**
- * Gets the query result format that this writer uses.
- */
- @Override
- public BooleanQueryResultFormat getBooleanQueryResultFormat() {
- return new BooleanQueryResultFormat("SPARQL/JSON",
- "application/sparql-results+json", Charset.forName("UTF-8"), "srj");
- }
-
- /**
- * Writes the specified boolean value.
- */
- @Override
- public void write(boolean value) throws IOException {
- PrintWriter writer = new PrintWriter(new OutputStreamWriter(out));
- writer.println("{ \"head\": {}, \"boolean\": \""+value+"\" }");
- writer.flush();
- writer.close();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java b/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java
deleted file mode 100644
index e067664..0000000
--- a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/services/sparqlio/sparqljson/SPARQLResultsJSONWriter.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.newmedialab.lmf.sparql.services.sparqlio.sparqljson;
-
-import java.io.BufferedWriter;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.io.OutputStreamWriter;
-import java.io.Writer;
-import java.nio.charset.Charset;
-import java.util.Iterator;
-import java.util.List;
-
-import info.aduna.io.IndentingWriter;
-import info.aduna.text.StringUtil;
-
-import org.openrdf.model.BNode;
-import org.openrdf.model.Literal;
-import org.openrdf.model.URI;
-import org.openrdf.model.Value;
-import org.openrdf.query.Binding;
-import org.openrdf.query.BindingSet;
-import org.openrdf.query.TupleQueryResultHandlerException;
-import org.openrdf.query.resultio.TupleQueryResultFormat;
-import org.openrdf.query.resultio.TupleQueryResultWriter;
-
-/**
- * A TupleQueryResultWriter that writes query results in the <a
- * href="http://www.w3.org/TR/rdf-sparql-json-res/">SPARQL Query Results JSON
- * Format</a>.
- */
-public class SPARQLResultsJSONWriter implements TupleQueryResultWriter {
-
- /*-----------*
- * Variables *
- *-----------*/
-
- private IndentingWriter writer;
-
- private boolean firstTupleWritten;
-
- /*--------------*
- * Constructors *
- *--------------*/
-
- public SPARQLResultsJSONWriter(OutputStream out) {
- Writer w = new OutputStreamWriter(out, Charset.forName("UTF-8"));
- w = new BufferedWriter(w, 1024);
- writer = new IndentingWriter(w);
- }
-
- /*---------*
- * Methods *
- *---------*/
-
- public final TupleQueryResultFormat getTupleQueryResultFormat() {
- return TupleQueryResultFormat.JSON;
- }
-
- public void startQueryResult(List<String> columnHeaders)
- throws TupleQueryResultHandlerException
- {
- try {
- openBraces();
-
- // Write header
- writeKey("head");
- openBraces();
- writeKeyValue("vars", columnHeaders);
- closeBraces();
-
- writeComma();
-
- // Write results
- writeKey("results");
- openBraces();
-
- writeKey("bindings");
- openArray();
-
- firstTupleWritten = false;
- }
- catch (IOException e) {
- throw new TupleQueryResultHandlerException(e);
- }
- }
-
- public void endQueryResult()
- throws TupleQueryResultHandlerException
- {
- try {
- closeArray(); // bindings array
- closeBraces(); // results braces
- closeBraces(); // root braces
- writer.flush();
- }
- catch (IOException e) {
- throw new TupleQueryResultHandlerException(e);
- }
- }
-
- public void handleSolution(BindingSet bindingSet)
- throws TupleQueryResultHandlerException
- {
- try {
- if (firstTupleWritten) {
- writeComma();
- }
- else {
- firstTupleWritten = true;
- }
-
- openBraces(); // start of new solution
-
- Iterator<Binding> bindingIter = bindingSet.iterator();
- while (bindingIter.hasNext()) {
- Binding binding = bindingIter.next();
-
- writeKeyValue(binding.getName(), binding.getValue());
-
- if (bindingIter.hasNext()) {
- writeComma();
- }
- }
-
- closeBraces(); // end solution
-
- writer.flush();
- }
- catch (IOException e) {
- throw new TupleQueryResultHandlerException(e);
- }
- }
-
- private void writeKeyValue(String key, String value)
- throws IOException
- {
- writeKey(key);
- writeString(value);
- }
-
- private void writeKeyValue(String key, Value value)
- throws IOException, TupleQueryResultHandlerException
- {
- writeKey(key);
- writeValue(value);
- }
-
- private void writeKeyValue(String key, Iterable<String> array)
- throws IOException
- {
- writeKey(key);
- writeArray(array);
- }
-
- private void writeKey(String key)
- throws IOException
- {
- writeString(key);
- writer.write(": ");
- }
-
- private void writeValue(Value value)
- throws IOException, TupleQueryResultHandlerException
- {
- writer.write("{ ");
-
- if (value instanceof URI) {
- writeKeyValue("type", "uri");
- writer.write(", ");
- writeKeyValue("value", ((URI)value).toString());
- }
- else if (value instanceof BNode) {
- writeKeyValue("type", "bnode");
- writer.write(", ");
- writeKeyValue("value", ((BNode)value).getID());
- }
- else if (value instanceof Literal) {
- Literal lit = (Literal)value;
-
- if (lit.getLanguage() != null) {
- writeKeyValue("xml:lang", lit.getLanguage());
- writer.write(", ");
- }
- if (lit.getDatatype() != null) {
- writeKeyValue("datatype", lit.getDatatype().toString());
- writer.write(", ");
- }
-
- writeKeyValue("type", "literal");
-
- writer.write(", ");
- writeKeyValue("value", lit.getLabel());
- }
- else {
- throw new TupleQueryResultHandlerException("Unknown Value object type: " + value.getClass());
- }
-
- writer.write(" }");
- }
-
- private void writeString(String value)
- throws IOException
- {
- // Escape special characters
- value = StringUtil.gsub("\\", "\\\\", value);
- value = StringUtil.gsub("\"", "\\\"", value);
- value = StringUtil.gsub("/", "\\/", value);
- value = StringUtil.gsub("\b", "\\b", value);
- value = StringUtil.gsub("\f", "\\f", value);
- value = StringUtil.gsub("\n", "\\n", value);
- value = StringUtil.gsub("\r", "\\r", value);
- value = StringUtil.gsub("\t", "\\t", value);
-
- writer.write("\"");
- writer.write(value);
- writer.write("\"");
- }
-
- private void writeArray(Iterable<String> array)
- throws IOException
- {
- writer.write("[ ");
-
- Iterator<String> iter = array.iterator();
- while (iter.hasNext()) {
- String value = iter.next();
-
- writeString(value);
-
- if (iter.hasNext()) {
- writer.write(", ");
- }
- }
-
- writer.write(" ]");
- }
-
- private void openArray()
- throws IOException
- {
- writer.write("[");
- writer.writeEOL();
- writer.increaseIndentation();
- }
-
- private void closeArray()
- throws IOException
- {
- writer.writeEOL();
- writer.decreaseIndentation();
- writer.write("]");
- }
-
- private void openBraces()
- throws IOException
- {
- writer.write("{");
- writer.writeEOL();
- writer.increaseIndentation();
- }
-
- private void closeBraces()
- throws IOException
- {
- writer.writeEOL();
- writer.decreaseIndentation();
- writer.write("}");
- }
-
- private void writeComma()
- throws IOException
- {
- writer.write(", ");
- writer.writeEOL();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/webservices/SparqlWebService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/webservices/SparqlWebService.java b/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/webservices/SparqlWebService.java
deleted file mode 100644
index aa73de0..0000000
--- a/platform/marmotta-sparql/src/main/java/at/newmedialab/lmf/sparql/webservices/SparqlWebService.java
+++ /dev/null
@@ -1,452 +0,0 @@
-/**
- * Copyright (C) 2013 Salzburg Research.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package at.newmedialab.lmf.sparql.webservices;
-
-import at.newmedialab.lmf.sparql.api.sparql.SparqlService;
-import at.newmedialab.lmf.sparql.services.sparqlio.rdf.SPARQLGraphResultWriter;
-import at.newmedialab.lmf.sparql.services.sparqlio.sparqlhtml.SPARQLBooleanHTMLWriter;
-import at.newmedialab.lmf.sparql.services.sparqlio.sparqlhtml.SPARQLResultsHTMLWriter;
-import at.newmedialab.lmf.sparql.services.sparqlio.sparqljson.SPARQLBooleanJSONWriter;
-import at.newmedialab.lmf.sparql.services.sparqlio.sparqljson.SPARQLResultsJSONWriter;
-import com.google.common.collect.Lists;
-import com.google.common.io.CharStreams;
-import org.apache.marmotta.platform.core.api.config.ConfigurationService;
-import org.apache.marmotta.platform.core.exception.InvalidArgumentException;
-import org.apache.marmotta.platform.core.exception.LMFException;
-import org.apache.marmotta.platform.core.util.WebServiceUtil;
-import org.apache.commons.lang.StringUtils;
-import org.apache.marmotta.commons.http.ContentType;
-import org.apache.marmotta.commons.http.LMFHttpUtils;
-import org.openrdf.query.MalformedQueryException;
-import org.openrdf.query.QueryEvaluationException;
-import org.openrdf.query.QueryLanguage;
-import org.openrdf.query.UpdateExecutionException;
-import org.openrdf.query.resultio.BooleanQueryResultWriter;
-import org.openrdf.query.resultio.TupleQueryResultWriter;
-import org.openrdf.query.resultio.sparqlxml.SPARQLBooleanXMLWriter;
-import org.openrdf.query.resultio.sparqlxml.SPARQLResultsXMLWriter;
-import org.openrdf.query.resultio.text.BooleanTextWriter;
-import org.openrdf.query.resultio.text.csv.SPARQLResultsCSVWriter;
-import org.slf4j.Logger;
-
-import javax.enterprise.context.ApplicationScoped;
-import javax.inject.Inject;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.*;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.core.StreamingOutput;
-
-import java.io.IOException;
-import java.io.OutputStream;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * Execute SPARQL query (both query and update) on the LMF triple store
- * according the SPARQL 1.1 Protocol
- *
- * @link http://www.w3.org/TR/sparql11-protocol/
- * @author Sebastian Schaffert
- * @author Sergio Fernández
- */
-@ApplicationScoped
-@Path("/sparql")
-public class SparqlWebService {
-
- @Inject
- private Logger log;
-
- @Inject
- private SparqlService sparqlService;
-
- @Inject
- private ConfigurationService configurationService;
-
- /**
- * For CORS operations TODO: make it more fine grained (maybe user dependent)
- * + TODO filter chain do not work properly
- *
- * @param reqHeaders
- * @return responde
- */
- @OPTIONS
- @Path("/update")
- public Response optionsResourceRemote(@HeaderParam("Access-Control-Request-Headers") String reqHeaders) {
- if(reqHeaders == null) {
- reqHeaders = "Accept, Content-Type";
- }
- return Response.ok()
- .header("Allow", "POST")
- .header("Access-Control-Allow-Methods","POST")
- .header("Access-Control-Allow-Headers", reqHeaders)
- .header("Access-Control-Allow-Origin",configurationService.getStringConfiguration("sparql.allow_origin","*"))
- .build();
-
- }
-
- /**
- * Execute a SPARQL 1.1 tuple query on the LMF triple store using the query passed as query parameter to the
- * GET request. Result will be formatted using the result type passed as argument (either "html", "json" or "xml").
- * <p/>
- * see SPARQL 1.1 Query syntax at http://www.w3.org/TR/sparql11-query/
- *
- * @param query the SPARQL 1.1 Query as a string parameter
- * @param resultType the format for serializing the query results ("html", "json", or "xml")
- * @HTTP 200 in case the query was executed successfully
- * @HTTP 500 in case there was an error during the query evaluation
- * @return the query result in the format passed as argument
- */
- @GET
- @Path("/select")
- public Response query(@QueryParam("query") String query, @QueryParam("output") String resultType, @Context HttpServletRequest request) {
- if(resultType == null) {
- List<ContentType> acceptedTypes = LMFHttpUtils.parseAcceptHeader(request.getHeader("Accept"));
- List<ContentType> offeredTypes = LMFHttpUtils.parseStringList(Lists.newArrayList("application/sparql-results+xml","application/sparql-results+json","text/html", "application/rdf+xml", "text/csv"));
-
- ContentType bestType = LMFHttpUtils.bestContentType(offeredTypes,acceptedTypes);
-
- if(bestType != null) {
- resultType = bestType.getMime();
- }
- }
-
- try {
- if(resultType != null) {
- if (StringUtils.isNotBlank(query))
- return buildQueryResponse(resultType, query);
- else {
- if (parseSubType(resultType).equals("html"))
- return Response.seeOther(new URI(configurationService.getServerUri() + "sparql/admin/snorql/snorql.html")).build();
- else
- return Response.status(Response.Status.BAD_REQUEST).entity("no SPARQL query specified").build();
- }
- } else
- return Response.status(Response.Status.BAD_REQUEST).entity("no result format specified or unsupported result format").build();
- } catch (InvalidArgumentException ex) {
- return Response.status(Response.Status.BAD_REQUEST).entity(ex.getMessage()).build();
- } catch(Exception e) {
- log.error("query execution threw an exception",e);
-
- return Response.serverError().entity("query not supported").build();
- }
- }
-
- /**
- * Execute a SPARQL 1.1 tuple query on the LMF triple store using the query passed as form parameter to the
- * POST request. Result will be formatted using the result type passed as argument (either "html", "json" or "xml").
- * <p/>
- * see SPARQL 1.1 Query syntax at http://www.w3.org/TR/sparql11-query/
- *
- * @param query the SPARQL 1.1 Query as a string parameter
- * @param resultType the format for serializing the query results ("html", "json", or "xml")
- * @HTTP 200 in case the query was executed successfully
- * @HTTP 500 in case there was an error during the query evaluation
- * @return the query result in the format passed as argument
- */
- @POST
- @Consumes("application/x-www-form-urlencoded")
- @Path("/select")
- public Response queryPostForm(@QueryParam("output") String resultType, @FormParam("query") String query, @Context HttpServletRequest request) {
- try {
- if(resultType == null) {
- List<ContentType> acceptedTypes = LMFHttpUtils.parseAcceptHeader(request.getHeader("Accept"));
- List<ContentType> offeredTypes = LMFHttpUtils.parseStringList(Lists.newArrayList("application/sparql-results+xml","application/sparql-results+json","text/html", "application/rdf+xml", "text/csv"));
-
- ContentType bestType = LMFHttpUtils.bestContentType(offeredTypes,acceptedTypes);
-
- if(bestType != null) {
- resultType = bestType.getMime();
- }
- }
- if(resultType != null) {
- if (StringUtils.isNotBlank(query))
- return buildQueryResponse(resultType, query);
- else
- return Response.status(Response.Status.BAD_REQUEST).entity("no SPARQL query specified").build();
- } else
- return Response.status(Response.Status.BAD_REQUEST).entity("no result format specified or unsupported result format").build();
- } catch (InvalidArgumentException ex) {
- return Response.status(Response.Status.BAD_REQUEST).entity(ex.getMessage()).build();
- } catch(Exception e) {
- log.error("query execution threw an exception",e);
-
- return Response.serverError().entity("query not supported").build();
- }
- }
-
- /**
- * Execute a SPARQL 1.1 tuple query on the LMF triple store using the query passed in the body of the
- * POST request. Result will be formatted using the result type passed as argument (either "html", "json" or "xml").
- * <p/>
- * see SPARQL 1.1 Query syntax at http://www.w3.org/TR/sparql11-query/
- *
- * @param request the servlet request (to retrieve the SPARQL 1.1 Query passed in the body of the POST request)
- * @param resultType the format for serializing the query results ("html", "json", or "xml")
- * @HTTP 200 in case the query was executed successfully
- * @HTTP 500 in case there was an error during the query evaluation
- * @return the query result in the format passed as argument
- */
- @POST
- @Path("/select")
- public Response queryPost(@QueryParam("output") String resultType, @Context HttpServletRequest request) {
- try {
- if(resultType == null) {
- List<ContentType> acceptedTypes = LMFHttpUtils.parseAcceptHeader(request.getHeader("Accept"));
- List<ContentType> offeredTypes = LMFHttpUtils.parseStringList(Lists.newArrayList("application/sparql-results+xml","application/sparql-results+json","text/html", "application/rdf+xml", "text/csv"));
-
- ContentType bestType = LMFHttpUtils.bestContentType(offeredTypes,acceptedTypes);
-
- if(bestType != null) {
- resultType = bestType.getMime();
- }
- }
-
- if(resultType != null) {
- String query = CharStreams.toString(request.getReader());
- if (query != null && !query.equals(""))
- return buildQueryResponse(resultType, query);
- else
- return Response.status(Response.Status.BAD_REQUEST).entity("no SPARQL query specified").build();
- } else
- return Response.status(Response.Status.BAD_REQUEST).entity("no result format specified or unsupported result format").build();
- } catch (InvalidArgumentException ex) {
- return Response.status(Response.Status.BAD_REQUEST).entity(ex.getMessage()).build();
- } catch(Exception e) {
- log.error("query execution threw an exception",e);
-
- return Response.serverError().entity("query not supported").build();
- }
- }
-
- /**
- * Execute a SPARQL 1.1 tuple query on the LMF triple store using the query passed as form parameter to the
- * POST request. Result will be formatted using the result type passed as argument (either "html", "json" or "xml").
- * <p/>
- * see SPARQL 1.1 Query syntax at http://www.w3.org/TR/sparql11-query/
- *
- * @param query the SPARQL 1.1 Query as a string parameter
- * @param resultType the format for serializing the query results ("html", "json", or "xml")
- * @HTTP 200 in case the query was executed successfully
- * @HTTP 500 in case there was an error during the query evaluation
- * @return the query result in the format passed as argument
- */
- @POST
- @Path("/snorql")
- public Response snorqlPost(@FormParam("output") String resultType, @FormParam("query") String query) {
- try {
- return buildQueryResponse(resultType, query);
- } catch(Exception e) {
- log.error("query execution threw an exception",e);
-
- return Response.serverError().entity("query not supported").build();
- }
- }
-
- /**
- * Execute a SPARQL 1.1 Update request passed in the query parameter of the GET. The update will
- * be carried out
- * on the LMF triple store.
- * <p/>
- * see SPARQL 1.1 Update syntax at http://www.w3.org/TR/sparql11-update/
- *
- * @param update the update query in SPARQL 1.1 syntax
- * @param query the update query in SPARUL syntax
- * @HTTP 200 in case the update was carried out successfully
- * @HTTP 500 in case the update was not successful
- * @return empty content in case the update was successful, the error message in case an error occurred
- */
- @GET
- @Path("/update")
- public Response updateGet(@QueryParam("update") String update, @QueryParam("query") String query, @QueryParam("output") String resultType,
- @Context HttpServletRequest request) {
- try {
- String q = getUpdateQuery(update, query);
- if (StringUtils.isNotBlank(q)) {
- sparqlService.update(QueryLanguage.SPARQL, q);
- return Response.ok().build();
- } else {
- if (resultType == null) {
- List<ContentType> acceptedTypes = LMFHttpUtils.parseAcceptHeader(request.getHeader("Accept"));
- List<ContentType> offeredTypes = LMFHttpUtils.parseStringList(Lists.newArrayList("*/*", "text/html"));
- ContentType bestType = LMFHttpUtils.bestContentType(offeredTypes, acceptedTypes);
- if (bestType != null) {
- resultType = bestType.getMime();
- }
- }
- if (parseSubType(resultType).equals("html"))
- return Response.seeOther(new URI(configurationService.getServerUri() + "sparql/admin/update.html")).build();
- else
- return Response.status(Response.Status.BAD_REQUEST).entity("no SPARQL query specified").build();
- }
- } catch (MalformedQueryException ex) {
- return Response.status(Response.Status.BAD_REQUEST).entity(WebServiceUtil.jsonErrorResponse(ex)).build();
- } catch(UpdateExecutionException e) {
- log.error("update execution threw an exception",e);
- return Response.serverError().entity(WebServiceUtil.jsonErrorResponse(e)).build();
- } catch (LMFException e) {
- return Response.serverError().entity(WebServiceUtil.jsonErrorResponse(e)).build();
- } catch (URISyntaxException e) {
- return Response.serverError().entity(WebServiceUtil.jsonErrorResponse(e)).build();
- }
- }
-
- /**
- * Get right update query from both possible parameters, for keeping
- * backward compatibility with the old parameter
- *
- * @param update update parameter
- * @param query query parameter
- * @return
- */
- private String getUpdateQuery(String update, String query) {
- if (StringUtils.isNotBlank(update))
- return update;
- else if (StringUtils.isNotBlank(query)) {
- log.warn("Update query still uses the old 'query' parameter");
- return query;
- } else
- return null;
- }
-
- /**
- * Execute a SPARQL 1.1 Update request passed in the request body of the POST. The update will
- * be carried out
- * on the LMF triple store.
- * <p/>
- * see SPARQL 1.1 Update syntax at http://www.w3.org/TR/sparql11-update/
- *
- * @param request the servlet request (to retrieve the SPARQL 1.1 Update query passed in the
- * body of the POST request)
- * @HTTP 200 in case the update was carried out successfully
- * @HTTP 500 in case the update was not successful
- * @return empty content in case the update was successful, the error message in case an error
- * occurred
- */
- @POST
- @Path("/update")
- public Response updatePost(@Context HttpServletRequest request) {
- try {
- String query = CharStreams.toString(request.getReader());
- if (StringUtils.isNotBlank(query)) {
- sparqlService.update(QueryLanguage.SPARQL, query);
- return Response.ok().build();
- } else
- return Response.status(Response.Status.BAD_REQUEST).entity("no SPARQL query given").build();
- } catch (MalformedQueryException ex) {
- return Response.status(Response.Status.BAD_REQUEST).entity(WebServiceUtil.jsonErrorResponse(ex)).build();
- } catch(UpdateExecutionException e) {
- log.error("update execution threw an exception",e);
- return Response.serverError().entity(WebServiceUtil.jsonErrorResponse(e)).build();
- } catch (LMFException e) {
- return Response.serverError().entity(WebServiceUtil.jsonErrorResponse(e)).build();
- } catch (IOException e) {
- return Response.serverError().entity(WebServiceUtil.jsonErrorResponse(e)).build();
- }
- }
-
- private Response buildQueryResponse(final String resultType, final String query) throws Exception {
- StreamingOutput entity = new StreamingOutput() {
- @Override
- public void write(OutputStream output) throws IOException, WebApplicationException {
- try {
- sparqlService.query(QueryLanguage.SPARQL,query,getTupleResultWriter(resultType,output),getBooleanResultWriter(resultType,output), getGraphResultWriter(resultType,output));
- } catch (LMFException ex) {
- throw new WebApplicationException(ex.getCause(), Response.status(Response.Status.BAD_REQUEST).entity(WebServiceUtil.jsonErrorResponse(ex)).build());
- } catch (QueryEvaluationException e) {
- throw new WebApplicationException(e.getCause(), Response.status(Response.Status.BAD_REQUEST).entity(WebServiceUtil.jsonErrorResponse(e)).build());
- } catch (MalformedQueryException e) {
- throw new WebApplicationException(e.getCause(), Response.status(Response.Status.BAD_REQUEST).entity(WebServiceUtil.jsonErrorResponse(e)).build());
- }
- }
- };
-
- //set returntype
- String s = "";
- if(resultType ==null) {
- s = "application/sparql-results+xml;charset=utf-8";
- } else if(parseSubType(resultType).equals("html") ) {
- s = "text/html;charset=utf-8";
- } else if(parseSubType(resultType).equals("json") ) {
- s = "application/sparql-results+json;charset=utf-8";
- } else if(parseSubType(resultType).equals("rdf+xml") ) {
- s = "application/rdf+xml;charset=utf-8";
- } else if(parseSubType(resultType).equals("rdf+n3") ) {
- s = "text/rdf+n3;charset=utf-8";
- } else if(parseSubType(resultType).equals("n3") ) {
- s = "text/rdf+n3;charset=utf-8";
- } else if(parseSubType(resultType).equals("csv") ) {
- s = "text/csv;charset=utf-8";
- } else {
- s = "application/sparql-results+xml;charset=utf-8";
- }
-
- Response r = Response.ok().entity(entity).header("Content-Type", s).build();
- return r;
- }
-
- private static Pattern subTypePattern = Pattern.compile("[a-z]+/([a-z0-9-._]+\\+)?([a-z0-9-._]+)(;.*)?");
- private String parseSubType(String mimeType) {
- Matcher matcher = subTypePattern.matcher(mimeType);
- if (matcher.matches())
- return matcher.group(2);
- else
- return mimeType;
- }
-
-
- private TupleQueryResultWriter getTupleResultWriter(String format, OutputStream os) {
- //build outputwriter
- final TupleQueryResultWriter out;
- if(format == null) {
- out = new SPARQLResultsXMLWriter(os);
- } else if(parseSubType(format).equals("html")) {
- out = new SPARQLResultsHTMLWriter(os);
- } else if(parseSubType(format).equals("json")) {
- out = new SPARQLResultsJSONWriter(os);
- } else if(parseSubType(format).equals("xml")) {
- out = new SPARQLResultsXMLWriter(os);
- } else if(parseSubType(format).equals("csv")) {
- out = new SPARQLResultsCSVWriter(os);
- } else throw new InvalidArgumentException("could not produce format "+format);
- return out;
- }
-
- private BooleanQueryResultWriter getBooleanResultWriter(String format, OutputStream os) {
- //build outputwriter
- final BooleanQueryResultWriter out;
- if(format == null) {
- out = new SPARQLBooleanXMLWriter(os);
- } else if(parseSubType(format).equals("html")) {
- out = new SPARQLBooleanHTMLWriter(os);
- } else if(parseSubType(format).equals("json")) {
- out = new SPARQLBooleanJSONWriter(os);
- } else if(parseSubType(format).equals("xml")) {
- out = new SPARQLBooleanXMLWriter(os);
- } else if(parseSubType(format).equals("csv")) {
- out = new BooleanTextWriter(os);
- } else throw new InvalidArgumentException("could not produce format "+format);
- return out;
- }
-
- protected SPARQLGraphResultWriter getGraphResultWriter(String format, OutputStream os) {
- return new SPARQLGraphResultWriter(os,format);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/api/sparql/SparqlService.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/api/sparql/SparqlService.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/api/sparql/SparqlService.java
new file mode 100644
index 0000000..2f777de
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/api/sparql/SparqlService.java
@@ -0,0 +1,83 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.marmotta.platform.sparql.api.sparql;
+
+import org.apache.marmotta.platform.sparql.services.sparqlio.rdf.SPARQLGraphResultWriter;
+import org.apache.marmotta.platform.core.exception.InvalidArgumentException;
+import org.apache.marmotta.platform.core.exception.LMFException;
+import org.openrdf.model.Value;
+import org.openrdf.query.MalformedQueryException;
+import org.openrdf.query.QueryEvaluationException;
+import org.openrdf.query.QueryLanguage;
+import org.openrdf.query.UpdateExecutionException;
+import org.openrdf.query.resultio.BooleanQueryResultWriter;
+import org.openrdf.query.resultio.TupleQueryResultWriter;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * Add file description here!
+ * <p/>
+ * User: sschaffe
+ */
+public interface SparqlService {
+
+
+ /**
+ * Evaluate a SPARQL query on the LMF TripleStore. Writes the query results to the output stream passed as argument os
+ * in the output format specified as argument outputFormat.
+ *
+ * see http://www.w3.org/TR/sparql11-query/
+ *
+ *
+ * @param queryLanguage the query language to use
+ * @param query the SPARQL query to evaluate in SPARQL 1.1 syntax
+ * @param tupleWriter the writer to use to write tuple query results
+ * @param booleanWriter the writer to use to write boolean query results
+ * @param graphWriter
+ * @throws InvalidArgumentException if the output format or query language are undefined
+ * @throws org.apache.marmotta.platform.core.exception.LMFException if the query evaluation fails
+ */
+ public void query(QueryLanguage queryLanguage, String query, TupleQueryResultWriter tupleWriter, BooleanQueryResultWriter booleanWriter, SPARQLGraphResultWriter graphWriter) throws InvalidArgumentException, LMFException, MalformedQueryException, QueryEvaluationException;
+
+
+
+ /**
+ * Evaluate a SPARQL query on the LMF TripleStore. Returns the results as a list of result maps, each element
+ * a KiWiNode.
+ *
+ * see http://www.w3.org/TR/sparql11-query/
+ *
+ * @param queryLanguage the query language to use
+ * @param query the SPARQL query to evaluate in SPARQL 1.1 syntax
+ */
+ public List<Map<String,Value>> query(QueryLanguage queryLanguage, String query) throws LMFException;
+
+
+ /**
+ * Execute a SPARQL update on the LMF TripleStore. Throws a KiWiException in case the update execution fails.
+ *
+ * see http://www.w3.org/TR/sparql11-update/
+ *
+ * @param queryLanguage
+ * @param query a string representing the update query in SPARQL Update 1.1 syntax
+ * @throws Exception
+ */
+ public void update(QueryLanguage queryLanguage, String query) throws InvalidArgumentException, LMFException, MalformedQueryException, UpdateExecutionException;
+
+
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/Public.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/Public.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/Public.java
new file mode 100644
index 0000000..9d6ba59
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/Public.java
@@ -0,0 +1,52 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * This class is generated by jOOQ
+ */
+package org.apache.marmotta.platform.sparql.model;
+
+import org.apache.marmotta.platform.sparql.model.tables.TNodes;
+import org.apache.marmotta.platform.sparql.model.tables.TTriples;
+
+/**
+ * This class is generated by jOOQ.
+ */
+@javax.annotation.Generated(value = {"http://www.jooq.org", "2.2.0"},
+ comments = "This class is generated by jOOQ")
+public class Public extends org.jooq.impl.SchemaImpl {
+
+ private static final long serialVersionUID = -664253339;
+
+ /**
+ * The singleton instance of public
+ */
+ //public static final Public PUBLIC = new Public();
+ public static final Public PUBLIC = null;
+
+ /**
+ * No further instances allowed
+ */
+ private Public() {
+ super("public");
+ }
+
+ @Override
+ public final java.util.List<org.jooq.Table<?>> getTables() {
+ return java.util.Arrays.<org.jooq.Table<?>>asList(
+ TNodes.KIWINODE,
+ TTriples.TRIPLES);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/Tables.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/Tables.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/Tables.java
new file mode 100644
index 0000000..185d9c5
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/Tables.java
@@ -0,0 +1,47 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * This class is generated by jOOQ
+ */
+package org.apache.marmotta.platform.sparql.model;
+
+import org.apache.marmotta.platform.sparql.model.tables.TNodes;
+import org.apache.marmotta.platform.sparql.model.tables.TTriples;
+
+/**
+ * This class is generated by jOOQ.
+ *
+ * Convenience access to all tables in public
+ */
+@javax.annotation.Generated(value = {"http://www.jooq.org", "2.2.0"},
+ comments = "This class is generated by jOOQ")
+public final class Tables {
+
+ /**
+ * The table public.kiwinode
+ */
+ public static TNodes KIWINODE = TNodes.KIWINODE;
+
+ /**
+ * The table public.triples
+ */
+ public static TTriples TRIPLES = TTriples.TRIPLES;
+
+ /**
+ * No instances
+ */
+ private Tables() {}
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/TNodes.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/TNodes.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/TNodes.java
new file mode 100644
index 0000000..5e322b4
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/TNodes.java
@@ -0,0 +1,157 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * This class is generated by jOOQ
+ */
+package org.apache.marmotta.platform.sparql.model.tables;
+
+import org.apache.marmotta.platform.sparql.model.tables.records.RNodes;
+import org.jooq.impl.SQLDataType;
+
+import java.sql.Timestamp;
+
+/**
+ * This class is generated by jOOQ.
+ */
+@javax.annotation.Generated(value = {"http://www.jooq.org", "2.2.0"},
+ comments = "This class is generated by jOOQ")
+public class TNodes extends org.jooq.impl.TableImpl<RNodes> {
+
+ private static final long serialVersionUID = 377156424;
+
+ /**
+ * The singleton instance of public.kiwinode
+ */
+ public static final TNodes KIWINODE = new TNodes();
+
+ /**
+ * The class holding records for this type
+ */
+ private static final java.lang.Class<RNodes> __RECORD_TYPE = RNodes.class;
+
+ /**
+ * The class holding records for this type
+ */
+ @Override
+ public java.lang.Class<RNodes> getRecordType() {
+ return __RECORD_TYPE;
+ }
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.String> NODETYPE = createField("nodetype", org.jooq.impl.SQLDataType.VARCHAR, this);
+
+ /**
+ * An uncommented item
+ *
+ * PRIMARY KEY
+ */
+ public final org.jooq.TableField<RNodes, java.lang.Long> ID = createField("id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.sql.Timestamp> CREATED = createField("created", org.jooq.impl.SQLDataType.TIMESTAMP, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.Boolean> DELETED = createField("deleted", org.jooq.impl.SQLDataType.BOOLEAN, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.Long> VERSION = createField("version", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.String> URI = createField("uri", org.jooq.impl.SQLDataType.VARCHAR, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.String> ANONID = createField("anonid", org.jooq.impl.SQLDataType.VARCHAR, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.String> CONTENTMD5 = createField("contentmd5", org.jooq.impl.SQLDataType.VARCHAR, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.String> LANGUAGE = createField("language", org.jooq.impl.SQLDataType.VARCHAR, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.String> TYPE = createField("type", org.jooq.impl.SQLDataType.VARCHAR, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.String> CONTENT = createField("content", org.jooq.impl.SQLDataType.CLOB, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.Long> INTCONTENT = createField("intcontent", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RNodes, java.lang.Double> DOUBLECONTENT = createField("doublecontent", org.jooq.impl.SQLDataType.DOUBLE, this);
+
+
+ public final org.jooq.TableField<RNodes, Timestamp> DATECONTENT = createField("datecontent", SQLDataType.TIMESTAMP, this);
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT kiwinode__fkbbc8d71252fbdfe5
+ * FOREIGN KEY (context_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public final org.jooq.TableField<RNodes, java.lang.Long> CONTEXT_ID = createField("context_id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT kiwinode__fkbbc8d71236cf857c
+ * FOREIGN KEY (creator_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public final org.jooq.TableField<RNodes, java.lang.Long> CREATOR_ID = createField("creator_id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ public TNodes() {
+ super("kiwinode", org.apache.marmotta.platform.sparql.model.Public.PUBLIC);
+ }
+
+ public TNodes(java.lang.String alias) {
+ super(alias, org.apache.marmotta.platform.sparql.model.Public.PUBLIC, TNodes.KIWINODE);
+ }
+
+ @Override
+ public TNodes as(java.lang.String alias) {
+ return new TNodes(alias);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/TTriples.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/TTriples.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/TTriples.java
new file mode 100644
index 0000000..e7438c5
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/TTriples.java
@@ -0,0 +1,149 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * This class is generated by jOOQ
+ */
+package org.apache.marmotta.platform.sparql.model.tables;
+
+import org.apache.marmotta.platform.sparql.model.tables.records.RTriples;
+
+/**
+ * This class is generated by jOOQ.
+ */
+@javax.annotation.Generated(value = {"http://www.jooq.org", "2.2.0"},
+ comments = "This class is generated by jOOQ")
+public class TTriples extends org.jooq.impl.TableImpl<RTriples> {
+
+ private static final long serialVersionUID = 1665365091;
+
+ /**
+ * The singleton instance of public.triples
+ */
+ public static final TTriples TRIPLES = new TTriples();
+
+ /**
+ * The class holding records for this type
+ */
+ private static final java.lang.Class<RTriples> __RECORD_TYPE = RTriples.class;
+
+ /**
+ * The class holding records for this type
+ */
+ @Override
+ public java.lang.Class<RTriples> getRecordType() {
+ return __RECORD_TYPE;
+ }
+
+ /**
+ * An uncommented item
+ *
+ * PRIMARY KEY
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Long> ID = createField("id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RTriples, java.sql.Timestamp> CREATED = createField("created", org.jooq.impl.SQLDataType.TIMESTAMP, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Boolean> DELETED = createField("deleted", org.jooq.impl.SQLDataType.BOOLEAN, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RTriples, java.sql.Timestamp> DELETEDAT = createField("deletedat", org.jooq.impl.SQLDataType.TIMESTAMP, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Boolean> INFERRED = createField("inferred", org.jooq.impl.SQLDataType.BOOLEAN, this);
+
+ /**
+ * An uncommented item
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Long> VERSION = createField("version", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb552fbdfe5
+ * FOREIGN KEY (context_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Long> CONTEXT_ID = createField("context_id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb536cf857c
+ * FOREIGN KEY (creator_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Long> CREATOR_ID = createField("creator_id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb5d2e5bf7d
+ * FOREIGN KEY (object_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Long> OBJECT_ID = createField("object_id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb593957dff
+ * FOREIGN KEY (property_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Long> PROPERTY_ID = createField("predicate_id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb5c267907c
+ * FOREIGN KEY (subject_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public final org.jooq.TableField<RTriples, java.lang.Long> SUBJECT_ID = createField("subject_id", org.jooq.impl.SQLDataType.BIGINT, this);
+
+ public TTriples() {
+ super("triples", org.apache.marmotta.platform.sparql.model.Public.PUBLIC);
+ }
+
+ public TTriples(java.lang.String alias) {
+ super(alias, org.apache.marmotta.platform.sparql.model.Public.PUBLIC, TTriples.TRIPLES);
+ }
+
+ @Override
+ public TTriples as(java.lang.String alias) {
+ return new TTriples(alias);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/records/RNodes.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/records/RNodes.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/records/RNodes.java
new file mode 100644
index 0000000..6e56330
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/records/RNodes.java
@@ -0,0 +1,276 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * This class is generated by jOOQ
+ */
+package org.apache.marmotta.platform.sparql.model.tables.records;
+
+import org.apache.marmotta.platform.sparql.model.tables.TNodes;
+
+/**
+ * This class is generated by jOOQ.
+ */
+@javax.annotation.Generated(value = {"http://www.jooq.org", "2.2.0"},
+ comments = "This class is generated by jOOQ")
+public class RNodes extends org.jooq.impl.TableRecordImpl<RNodes> {
+
+ private static final long serialVersionUID = 1708898505;
+
+ /**
+ * An uncommented item
+ */
+ public void setNodetype(java.lang.String value) {
+ setValue(TNodes.KIWINODE.NODETYPE, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.String getNodetype() {
+ return getValue(TNodes.KIWINODE.NODETYPE);
+ }
+
+ /**
+ * An uncommented item
+ *
+ * PRIMARY KEY
+ */
+ public void setId(java.lang.Long value) {
+ setValue(TNodes.KIWINODE.ID, value);
+ }
+
+ /**
+ * An uncommented item
+ *
+ * PRIMARY KEY
+ */
+ public java.lang.Long getId() {
+ return getValue(TNodes.KIWINODE.ID);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setCreated(java.sql.Timestamp value) {
+ setValue(TNodes.KIWINODE.CREATED, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.sql.Timestamp getCreated() {
+ return getValue(TNodes.KIWINODE.CREATED);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setDeleted(java.lang.Boolean value) {
+ setValue(TNodes.KIWINODE.DELETED, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.Boolean getDeleted() {
+ return getValue(TNodes.KIWINODE.DELETED);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setVersion(java.lang.Long value) {
+ setValue(TNodes.KIWINODE.VERSION, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.Long getVersion() {
+ return getValue(TNodes.KIWINODE.VERSION);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setUri(java.lang.String value) {
+ setValue(TNodes.KIWINODE.URI, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.String getUri() {
+ return getValue(TNodes.KIWINODE.URI);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setAnonid(java.lang.String value) {
+ setValue(TNodes.KIWINODE.ANONID, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.String getAnonid() {
+ return getValue(TNodes.KIWINODE.ANONID);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setContentmd5(java.lang.String value) {
+ setValue(TNodes.KIWINODE.CONTENTMD5, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.String getContentmd5() {
+ return getValue(TNodes.KIWINODE.CONTENTMD5);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setLanguage(java.lang.String value) {
+ setValue(TNodes.KIWINODE.LANGUAGE, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.String getLanguage() {
+ return getValue(TNodes.KIWINODE.LANGUAGE);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setType(java.lang.String value) {
+ setValue(TNodes.KIWINODE.TYPE, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.String getType() {
+ return getValue(TNodes.KIWINODE.TYPE);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setContent(java.lang.String value) {
+ setValue(TNodes.KIWINODE.CONTENT, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.String getContent() {
+ return getValue(TNodes.KIWINODE.CONTENT);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setIntcontent(java.lang.Long value) {
+ setValue(TNodes.KIWINODE.INTCONTENT, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.Long getIntcontent() {
+ return getValue(TNodes.KIWINODE.INTCONTENT);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setDoublecontent(java.lang.Double value) {
+ setValue(TNodes.KIWINODE.DOUBLECONTENT, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.Double getDoublecontent() {
+ return getValue(TNodes.KIWINODE.DOUBLECONTENT);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT kiwinode__fkbbc8d71252fbdfe5
+ * FOREIGN KEY (context_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public void setContextId(java.lang.Long value) {
+ setValue(TNodes.KIWINODE.CONTEXT_ID, value);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT kiwinode__fkbbc8d71252fbdfe5
+ * FOREIGN KEY (context_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public java.lang.Long getContextId() {
+ return getValue(TNodes.KIWINODE.CONTEXT_ID);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT kiwinode__fkbbc8d71236cf857c
+ * FOREIGN KEY (creator_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public void setCreatorId(java.lang.Long value) {
+ setValue(TNodes.KIWINODE.CREATOR_ID, value);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT kiwinode__fkbbc8d71236cf857c
+ * FOREIGN KEY (creator_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public java.lang.Long getCreatorId() {
+ return getValue(TNodes.KIWINODE.CREATOR_ID);
+ }
+
+ /**
+ * Create a detached KiwinodeRecord
+ */
+ public RNodes() {
+ super(TNodes.KIWINODE);
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-marmotta/blob/69cbd57a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/records/RTriples.java
----------------------------------------------------------------------
diff --git a/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/records/RTriples.java b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/records/RTriples.java
new file mode 100644
index 0000000..bf37f88
--- /dev/null
+++ b/platform/marmotta-sparql/src/main/java/org/apache/marmotta/platform/sparql/model/tables/records/RTriples.java
@@ -0,0 +1,256 @@
+/**
+ * Copyright (C) 2013 Salzburg Research.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * This class is generated by jOOQ
+ */
+package org.apache.marmotta.platform.sparql.model.tables.records;
+
+import org.apache.marmotta.platform.sparql.model.tables.TTriples;
+
+/**
+ * This class is generated by jOOQ.
+ */
+@javax.annotation.Generated(value = {"http://www.jooq.org", "2.2.0"},
+ comments = "This class is generated by jOOQ")
+public class RTriples extends org.jooq.impl.TableRecordImpl<RTriples> {
+
+ private static final long serialVersionUID = 971957447;
+
+ /**
+ * An uncommented item
+ *
+ * PRIMARY KEY
+ */
+ public void setId(java.lang.Long value) {
+ setValue(TTriples.TRIPLES.ID, value);
+ }
+
+ /**
+ * An uncommented item
+ *
+ * PRIMARY KEY
+ */
+ public java.lang.Long getId() {
+ return getValue(TTriples.TRIPLES.ID);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setCreated(java.sql.Timestamp value) {
+ setValue(TTriples.TRIPLES.CREATED, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.sql.Timestamp getCreated() {
+ return getValue(TTriples.TRIPLES.CREATED);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setDeleted(java.lang.Boolean value) {
+ setValue(TTriples.TRIPLES.DELETED, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.Boolean getDeleted() {
+ return getValue(TTriples.TRIPLES.DELETED);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setDeletedat(java.sql.Timestamp value) {
+ setValue(TTriples.TRIPLES.DELETEDAT, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.sql.Timestamp getDeletedat() {
+ return getValue(TTriples.TRIPLES.DELETEDAT);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setInferred(java.lang.Boolean value) {
+ setValue(TTriples.TRIPLES.INFERRED, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.Boolean getInferred() {
+ return getValue(TTriples.TRIPLES.INFERRED);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public void setVersion(java.lang.Long value) {
+ setValue(TTriples.TRIPLES.VERSION, value);
+ }
+
+ /**
+ * An uncommented item
+ */
+ public java.lang.Long getVersion() {
+ return getValue(TTriples.TRIPLES.VERSION);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb552fbdfe5
+ * FOREIGN KEY (context_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public void setContextId(java.lang.Long value) {
+ setValue(TTriples.TRIPLES.CONTEXT_ID, value);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb552fbdfe5
+ * FOREIGN KEY (context_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public java.lang.Long getContextId() {
+ return getValue(TTriples.TRIPLES.CONTEXT_ID);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb536cf857c
+ * FOREIGN KEY (creator_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public void setCreatorId(java.lang.Long value) {
+ setValue(TTriples.TRIPLES.CREATOR_ID, value);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb536cf857c
+ * FOREIGN KEY (creator_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public java.lang.Long getCreatorId() {
+ return getValue(TTriples.TRIPLES.CREATOR_ID);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb5d2e5bf7d
+ * FOREIGN KEY (object_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public void setObjectId(java.lang.Long value) {
+ setValue(TTriples.TRIPLES.OBJECT_ID, value);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb5d2e5bf7d
+ * FOREIGN KEY (object_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public java.lang.Long getObjectId() {
+ return getValue(TTriples.TRIPLES.OBJECT_ID);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb593957dff
+ * FOREIGN KEY (property_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public void setPropertyId(java.lang.Long value) {
+ setValue(TTriples.TRIPLES.PROPERTY_ID, value);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb593957dff
+ * FOREIGN KEY (property_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public java.lang.Long getPropertyId() {
+ return getValue(TTriples.TRIPLES.PROPERTY_ID);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb5c267907c
+ * FOREIGN KEY (subject_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public void setSubjectId(java.lang.Long value) {
+ setValue(TTriples.TRIPLES.SUBJECT_ID, value);
+ }
+
+ /**
+ * An uncommented item
+ * <p>
+ * <code><pre>
+ * CONSTRAINT triples__fkeba30bb5c267907c
+ * FOREIGN KEY (subject_id)
+ * REFERENCES public.kiwinode (id)
+ * </pre></code>
+ */
+ public java.lang.Long getSubjectId() {
+ return getValue(TTriples.TRIPLES.SUBJECT_ID);
+ }
+
+ /**
+ * Create a detached TriplesRecord
+ */
+ public RTriples() {
+ super(TTriples.TRIPLES);
+ }
+}