diff --git a/doc/endpoints.md b/doc/endpoints.md deleted file mode 100644 index 567e9020898e76ecba7b94c7ee5c21308ec6ea26..0000000000000000000000000000000000000000 --- a/doc/endpoints.md +++ /dev/null @@ -1,74 +0,0 @@ -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 diff --git a/doc/report/Makefile b/doc/report/Makefile index f72c84727a35e6ea23e0ed85000b973f028b83ea..5f5455bcac98b25e05041957a07657edbfbe6b84 100644 --- a/doc/report/Makefile +++ b/doc/report/Makefile @@ -1,4 +1,6 @@ -report.pdf: report.tex references.bib +TEX_SOURCES = report.tex abstract.tex endpoint.tex + +report.pdf: $(TEX_SOURCES) references.bib chronic pdflatex $< chronic biber $(basename $<) chronic pdflatex $< diff --git a/doc/report/abstract.tex b/doc/report/abstract.tex new file mode 100644 index 0000000000000000000000000000000000000000..f6276be2166e262fa02b81cf187ed5e54b9ce3fe --- /dev/null +++ b/doc/report/abstract.tex @@ -0,0 +1 @@ +\lipsum[1] diff --git a/doc/report/endpoint.tex b/doc/report/endpoint.tex new file mode 100644 index 0000000000000000000000000000000000000000..72a6ebb7fab7ed91511b70eb864ec09cf008d711 --- /dev/null +++ b/doc/report/endpoint.tex @@ -0,0 +1,49 @@ +\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}. diff --git a/doc/report/references.bib b/doc/report/references.bib index 51d2e27cc8de8e7874df8776e56b4347a5ad4b91..09a4433d9c044499786f5bd889da3513ea13a9ab 100644 --- a/doc/report/references.bib +++ b/doc/report/references.bib @@ -1,8 +1,47 @@ -@online{wikibook, - title = {Generating Bibliographies with biblatex and biber}, - organization = {Wikibooks}, - date = {2016}, - urldate = {2016-03-07}, - url = {https://en.wikibooks.org/wiki/LaTeX/Generating_Bibliographies_with_biblatex_and_biber}, - keywords = {untrusted}, +@online{sparql, + title = {SPARQL Query Language for RDF}, + organization = {W3C}, + date = {2009}, + urldate = {2020-06-10}, + url = {https://www.w3.org/TR/rdf-sparql-query/}, } + +@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 diff --git a/doc/report/report.tex b/doc/report/report.tex index b7fa6acda0500ba1f557042200a993b29a8b2d1a..5fd7ebd3a70766dd6c893aa1524b5b0c1ed3d116 100644 --- a/doc/report/report.tex +++ b/doc/report/report.tex @@ -1,14 +1,22 @@ \documentclass[a4paper]{scrartcl} -\usepackage[backend=biber]{biblatex} \usepackage[utf8]{inputenc} \usepackage{amsmath} \usepackage{geometry} \usepackage{hyperref} \usepackage{lipsum} \usepackage{multicol} +\usepackage{verbatim} +\usepackage[ + backend=biber, + natbib=true, + style=numeric, + sorting=none +]{biblatex} + \addbibresource{references.bib} + \geometry{a4paper, portrait} \pagenumbering{gobble} @@ -24,54 +32,12 @@ % [Abstract] \begin{abstract} -\lipsum[1] + \input{abstract.tex} \end{abstract} -\section{Crystal Palace} - -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}. +\input{endpoint.tex} +\newpage \printbibliography{} \end{document}