Skip to content
Snippets Groups Projects
Commit b27054b8 authored by Andreas Schärtl's avatar Andreas Schärtl
Browse files

report: review endpoints

parent 3fd1ab97
No related branches found
No related tags found
No related merge requests found
...@@ -12,63 +12,63 @@ one based around the standardized SPARQL query language and the other ...@@ -12,63 +12,63 @@ one based around the standardized SPARQL query language and the other
on the RDF4J Java library implemented by various vendors. Both on the RDF4J Java library implemented by various vendors. Both
approaches have unique advantages. approaches have unique advantages.
\subsection{Available Application Interfaces} \begin{description}
\item[SPARQL] is a standardized query language for RDF triplet
data~\cite{sparql}. The specification includes not just syntax
and semantics of the language itself, but also a standardized
REST interface for querying databases.
\begin{itemize} \textbf{Syntax} SPARQL is inspired by SQL and as such the
\item SPARQL is a standardized query language for RDF triplet \texttt{SELECT} \texttt{WHERE} syntax should be familiar to many
data~\cite{sparql}. The spec includes not just syntax and software developers. A simple query that returns all triplets
semantics of the language itself, but also a standardized REST in the store looks like
interface for querying databases. Various implementations of \begin{lstlisting}
this standard, e.g.~\cite{gosparql}, are available so using
SPARQL has the advantage of making us independent of a specific
programming language or environment.
SPARQL is inspired by SQL and as such the \texttt{SELECT}
\texttt{WHERE} syntax should be familiar to many software
developers. A simple query that returns all triplets in the
store looks like
\begin{verbatim}
SELECT * WHERE { ?s ?p ?o } SELECT * WHERE { ?s ?p ?o }
\end{verbatim} \end{lstlisting}
where \texttt{?s}, \texttt{?p} and \texttt{?o} are query where \texttt{?s}, \texttt{?p} and \texttt{?o} are query
variables. The result of a query are valid substitutions for the variables. The result of any query are valid substitutions for
query variables. In this case, the database would return a table the query variables. In this particular case, the database would
of all triplets in the store sorted by subject~\texttt{?o}, return a table of all triplets in the store sorted by
predicate~\texttt{?p} and object~\texttt{?o}. subject~\texttt{?o}, predicate~\texttt{?p} and
object~\texttt{?o}.
Of course, queries might return a lot of data. Importing just \textbf{Advantage} Probably the biggest advantage is that
the Isabelle exports into GraphDB results in more than 200 SPARQL is ubiquitous. As it is the de facto standard for
million triplets. For practical applications it will be querying triplet stores, lots of literature and documentation is
necessary to limit the number of result or use pagination available~\cite{sparqlbook, sparqlimpls, gosparql}.
techniques~\cite{sparqlpagination}.
\item RDF4J is a Java API for interacting with triplet stores, \item[RDF4J] is a Java API for interacting with triplet stores,
implemented based on a superset of implemented based on a superset of the {SPARQL} REST interface~\cite{rdf4j}.
{SPARQL}~\cite{rdf4j}. GraphDB supports RDF4J, in fact it is the GraphDB supports RDF4J, in fact it is the recommended way of
recommended way of interacting with GraphDB interacting with GraphDB repositories~\cite{graphdbapi}.
repositories~\cite{graphdbapi}. Instead of formulating textual
queries, RDF4J allows developers to query a repository by
calling Java API methods. Above query that returns all triplets
in the store looks like
\begin{verbatim}
connection.getStatements(null, null, null);
\end{verbatim}
in RDF4J. Method \texttt{getStatements(s, p, o)} returns all
triplets that have matching subject~\texttt{s},
predicate~\texttt{p} and object~\texttt{o}. If any of these
arguments is \texttt{null}, it can be any value, i.e.\ it is a
query variable that is to be filled by the call to
\texttt{getStatements}.
Using RDF4J does introduce a dependency on the JVM family of \textbf{Syntax} Instead of formulating textual queries, RDF4J
languages, but also offers some conveniences. For example, we allows developers to query a repository by calling Java API
can generate Java classes that contain all URIs in an OWL methods. Previous query that requests all triplets in the store
ontology as constants~\cite{rdf4jgen}. In combination with IDE looks like
support, we found this to be very convenient when writing \begin{lstlisting}
applications that interface with ULO data sets. connection.getStatements(null, null, null);
\end{lstlisting}
in RDF4J. \texttt{getStatements(s, p, o)} returns all triplets
that have matching subject~\texttt{s}, predicate~\texttt{p} and
object~\texttt{o}. Any argument that is \texttt{null} can be
replace with any value, i.e.\ it is a query variable to be
filled by the call to \texttt{getStatements}.
\end{itemize} \textbf{Advantage} Using RDF4J does introduce a dependency on
the JVM and its languages. But in practice, we found RDF4J to be
quite convenient, especially for simple queries, as it allows us
to formulate everything in a single programming language rather
than mixing languages and awkward string literals.
\subsection{Comparison} We also found it quite helpful to generate Java classes from
OWL ontologies that contain all definitions of the ontology and
make it readable by any IDE~\cite{rdf4jgen}.
\end{description}
\emph{TODO} We see that both SPARQL and RDF4J have unique advantages. While SPARQL
is an official W3C standard and implemented by more database systems,
RDF4J can be more convenient when dealing with JVM-based code bases.
For \emph{ulo-storage}, we played around with both interfaces and
chose whatever seemed more convenient at the moment. We recommend any
implementors to do the same.
...@@ -14,6 +14,13 @@ ...@@ -14,6 +14,13 @@
url = {https://godoc.org/github.com/knakk/sparql}, url = {https://godoc.org/github.com/knakk/sparql},
} }
@online{sparqlimpls,
title = {SparqlImplementations},
organization = {W3C},
url = {https://www.w3.org/wiki/SparqlImplementations},
urldate = {2020-07-06},
}
@online{uloisabelle, @online{uloisabelle,
title = {Isabelle: Libraries of the Isabelle proof assistant in OMDoc/MMT representation}, title = {Isabelle: Libraries of the Isabelle proof assistant in OMDoc/MMT representation},
organization = {MathHub}, organization = {MathHub},
...@@ -140,3 +147,10 @@ ...@@ -140,3 +147,10 @@
urldate = {2020-07-06}, urldate = {2020-07-06},
url = {https://kwarc.info/people/frabe/Research/GKKMR_alignments_17.pdf}, url = {https://kwarc.info/people/frabe/Research/GKKMR_alignments_17.pdf},
} }
@book{sparqlbook,
title={Learning SPARQL: querying and updating with SPARQL 1.1},
author={DuCharme, Bob},
year={2013},
publisher={" O'Reilly Media, Inc."}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment