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

report: port markdown about endpoints to latex

parent 04f7d8cc
No related branches found
No related tags found
No related merge requests found
Endpoints
=========
With ULO/RDF triplets imported into a database, in our case GraphDB, we
have all data available for querying. There are multiple approaches
to querying such triplet stores.
SPARQL
------
SPARQL [1] is a standardized query language for RDF triplet data. The spec
includes not just syntax and semantics of the language itself, but also
a standardized REST interface for querying databases.
Various implementations of this standard, e.g. [2], are available so
using SPARQL has the advantage of making us independent of a specific
programming language or environment.
SPARQL is inspired by SQL, a simple query that returns all triplets
in the store looks like
SELECT *
WHERE { ?s ?p ?o }
where `s`, `p` and `o` are query variables. The result of a query are
valid substitutions for the query variables. In this case, the
database would return a table of all triplets in the store sorted by
subject `s`, predicate `p` and object `o`.
Of course, queries might return a lot of data. Importing just the Isabelle exports [3] into GraphDB results in >200M triplets. This
is solved with pagination techniques [4].
RDF4J
-----
RDF4J [5] is a Java API for interacting with triplet stores, implemented
based on a superset of SPARQL. GraphDB supports RDF4J, in fact it is the
recommended way of interacting with GraphDB repositories [6].
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
connection.getStatements(null, null, null);
in RDF4J. Method `getStatements(s, p, o)` returns all triplets that
have matching subject `s`, predicate `p` and object `o`. If any of
these arguments is `null`, it can be any value, i.e. it is a query
variable that is to be filled by the call to `getStatements`.
Comparing SPARQL to RDF4J
-------------------------
While plain SPARQL offers independence from the JVM, RDF4J is a
convenient interface that makes it easy to write applications with
problems like pagination already taken care of.
Of course the interesting question for the task of building an ULO/RDF
endpoint is what works better for this particular application.
References
----------
[1] https://www.w3.org/TR/rdf-sparql-query/
[2] https://godoc.org/github.com/knakk/sparql
[3] https://gl.mathhub.info/Isabelle
[4] https://stackoverflow.com/questions/27488403/paginating-sparql-results
[5] https://rdf4j.org/
[6] http://graphdb.ontotext.com/documentation/free/using-graphdb-with-the-rdf4j-api.html
report.pdf: report.tex references.bib TEX_SOURCES = report.tex abstract.tex endpoint.tex
report.pdf: $(TEX_SOURCES) references.bib
chronic pdflatex $< chronic pdflatex $<
chronic biber $(basename $<) chronic biber $(basename $<)
chronic pdflatex $< chronic pdflatex $<
......
\lipsum[1]
\section{Endpoints}
With ULO/RDF triplets imported into a database, in our case GraphDB,
we have all data available for querying. There are multiple approaches
to querying such triplet stores.
\subsection{SPARQL}
SPARQL~\cite{sparql} is a standardized query language for RDF triplet
data. The spec includes not just syntax and semantics of the language
itself, but also a standardized REST interface for querying databases.
Various implementations of 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, a simple query that returns all triplets
in the store looks like
\begin{verbatim}
SELECT * WHERE { ?s ?p ?o }
\end{verbatim}
where \texttt{s}, \texttt{p} and \texttt{o} are query variables. The
result of a query are valid substitutions for the query variables. In
this case, the database would return a table of all triplets in the
store sorted by subject~\texttt{o}, predicate~\texttt{p} and
object~\texttt{o}.
Of course, queries might return a lot of data. Importing just the
Isabelle exports~\cite{uloisabelle} into GraphDB results in more than
200M triplets. This is solved with pagination
techniques~\cite{sparqlpagination}.
\subsection{RDF4J}
RDF4J~\cite{rdf4j} is a Java API for interacting with triplet stores,
implemented based on a superset of SPARQL. GraphDB supports RDF4J, in
fact it is the recommended way of interacting with GraphDB
repositories [6].
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}.
@online{wikibook, @online{sparql,
title = {Generating Bibliographies with biblatex and biber}, title = {SPARQL Query Language for RDF},
organization = {Wikibooks}, organization = {W3C},
date = {2016}, date = {2009},
urldate = {2016-03-07}, urldate = {2020-06-10},
url = {https://en.wikibooks.org/wiki/LaTeX/Generating_Bibliographies_with_biblatex_and_biber}, url = {https://www.w3.org/TR/rdf-sparql-query/},
keywords = {untrusted},
} }
@online{gosparql,
title = {package sparql},
organization = {godoc.org},
date = {2019},
urldate = {2020-06-10},
url = {https://godoc.org/github.com/knakk/sparql},
}
@online{uloisabelle,
title = {Isabelle: Libraries of the Isabelle proof assistant in OMDoc/MMT representation},
organization = {MathHub},
date = {2019},
urldate = {2020-06-10},
url = {https://gl.mathhub.info/Isabelle}
}
@online{sparqlpagination,
title = {Paginating SPARQL results},
author = {Joshua Taylor},
date = {2014},
urldate = {2020-06-10},
url = {https://stackoverflow.com/questions/27488403/paginating-sparql-results},
}
@online{rdf4j,
title = {Eclipse rdf4j},
organization = {The Eclipse Foundation},
date = {2020},
urldate = {2020-06-10},
url = {https://rdf4j.org/},
}
@online{graphdbapi,
title = {Using GraphDB with the RDF4J API},
organization = {Ontotext},
date = {2020},
urldate = {2020-06-10},
url = {http://graphdb.ontotext.com/documentation/free/using-graphdb-with-the-rdf4j-api.html},
}
\ No newline at end of file
\documentclass[a4paper]{scrartcl} \documentclass[a4paper]{scrartcl}
\usepackage[backend=biber]{biblatex}
\usepackage[utf8]{inputenc} \usepackage[utf8]{inputenc}
\usepackage{amsmath} \usepackage{amsmath}
\usepackage{geometry} \usepackage{geometry}
\usepackage{hyperref} \usepackage{hyperref}
\usepackage{lipsum} \usepackage{lipsum}
\usepackage{multicol} \usepackage{multicol}
\usepackage{verbatim}
\usepackage[
backend=biber,
natbib=true,
style=numeric,
sorting=none
]{biblatex}
\addbibresource{references.bib} \addbibresource{references.bib}
\geometry{a4paper, portrait} \geometry{a4paper, portrait}
\pagenumbering{gobble} \pagenumbering{gobble}
...@@ -24,54 +32,12 @@ ...@@ -24,54 +32,12 @@
% [Abstract] % [Abstract]
\begin{abstract} \begin{abstract}
\lipsum[1] \input{abstract.tex}
\end{abstract} \end{abstract}
\section{Crystal Palace} \input{endpoint.tex}
Then --- this is all what you say --- new economic relations will be
established, all ready-made and worked out with mathematical
exactitude, so that every possible question will vanish in the
twinkling of an eye, simply because every possible answer to it will be
provided. Then the "Palace of Crystal" will be built. Then ... In
fact, those will be halcyon days. Of course there is no guaranteeing
(this is my comment) that it will not be, for instance, frightfully
dull then (for what will one have to do when everything will be
calculated and tabulated), but on the other hand everything will be
extraordinarily rational. Of course boredom may lead you to anything.
It is boredom sets one sticking golden pins into people, but all that
would not matter. What is bad (this is my comment again) is that I
dare say people will be thankful for the gold pins then. Man is
stupid, you know, phenomenally stupid; or rather he is not at all
stupid, but he is so ungrateful that you could not find another like
him in all creation. I, for instance, would not be in the least
surprised if all of a sudden, A PROPOS of nothing, in the midst of
general prosperity a gentleman with an ignoble, or rather with a
reactionary and ironical, countenance were to arise and, putting his
arms akimbo, say to us all: "I say, gentleman, hadn't we better kick
over the whole show and scatter rationalism to the winds, simply to
send these logarithms to the devil, and to enable us to live once more
at our own sweet foolish will!" That again would not matter, but what
is annoying is that he would be sure to find followers --- such is the
nature of man. And all that for the most foolish reason, which, one
would think, was hardly worth mentioning: that is, that man everywhere
and at all times, whoever he may be, has preferred to act as he chose
and not in the least as his reason and advantage dictated. And one may
choose what is contrary to one's own interests, and sometimes one
POSITIVELY OUGHT (that is my idea). One's own free unfettered choice,
one's own caprice, however wild it may be, one's own fancy worked up at
times to frenzy --- is that very "most advantageous advantage" which we
have overlooked, which comes under no classification and against which
all systems and theories are continually being shattered to atoms.
\section{Choice}
And how do these wiseacres know that man wants a normal, a virtuous
choice? What has made them conceive that man must want a rationally
advantageous choice? What man wants is simply INDEPENDENT choice,
whatever that independence may cost and wherever it may lead. And
choice, of course, the devil only knows what choice~\cite{wikibook}.
\newpage
\printbibliography{} \printbibliography{}
\end{document} \end{document}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment