From a6d7fcbb602d74b4d2ec4c9c3b3f30b9a8f03428 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Sch=C3=A4rtl?= <andreas@schaertl.me>
Date: Tue, 30 Jun 2020 13:44:37 +0200
Subject: [PATCH] report: [x] implement Q5

---
 doc/report/applications.tex | 39 ++++++++++++++++++++++++++++++++++---
 doc/report/report.tex       |  3 +++
 2 files changed, 39 insertions(+), 3 deletions(-)

diff --git a/doc/report/applications.tex b/doc/report/applications.tex
index 5288776..257bb61 100644
--- a/doc/report/applications.tex
+++ b/doc/report/applications.tex
@@ -117,9 +117,9 @@ proof of concept implementations.
    is asking by works of a given author~$A$.  It also ask for their
    main contributions, e.g.\ what paragraphs or code~$A$ has authored.
 
-   ULO has no concept of authors, contributors dates and so
-   on. Rather, the idea is to take advantage of the Dublin Core
-   project which provides an ontology for such
+   \textbf{Organizational Aspect} ULO has no concept of authors,
+   contributors dates and so on. Rather, the idea is to take advantage
+   of the Dublin Core project which provides an ontology for such
    metadata~\cite{dcreport, dcowl}. For example, Dublin Core provides
    us with the \texttt{dcterms:creator} predicate. Servicing this
    query would mean looking for the creator~$A$ and then listing all
@@ -133,4 +133,37 @@ proof of concept implementations.
    result by number of references might be a good start. Again, this
    is something that should serviceable with just organizational
    knowledge.
+
+   \textbf{Implementation} Search for contributions by a given author
+   can easily be formulated in {SPARQL}.
+   \begin{lstlisting}
+    PREFIX ulo: <https://mathhub.info/ulo#>
+    PREFIX dcterms: <http://purl.org/dc/terms/>
+
+    SELECT ?work
+    WHERE {
+        ?work dcterms:contributor "John Smith" .
+    }
+    GROUP BY ?work
+   \end{lstlisting}
+   To get all main contributions, we rate each
+   individual \texttt{?work} by its number of \texttt{ulo:uses}
+   references. Extending the {SPARQL} query, we can query the database
+   for a ordered list of works, starting with the one that has the
+   most references.
+   \begin{lstlisting}
+    PREFIX ulo: <https://mathhub.info/ulo#>
+    PREFIX dcterms: <http://purl.org/dc/terms/>
+
+    SELECT ?work (COUNT(?user) as ?refcount)
+    WHERE {
+        ?work dcterms:contributor "John Smith" .
+        ?user ulo:uses ?work .
+    }
+    GROUP BY ?work
+    ORDER BY DESC(?refcount)
+   \end{lstlisting}
+   We see that we can formulate the idea behind~$\mathcal{Q}_{5}$ with
+   one not very complicated SPARQL query. Because here everything is
+   handled by the database access should be quick.
 \end{itemize}
diff --git a/doc/report/report.tex b/doc/report/report.tex
index c172374..0a6ae02 100644
--- a/doc/report/report.tex
+++ b/doc/report/report.tex
@@ -7,6 +7,7 @@
 \usepackage{graphicx}
 \usepackage{hyperref}
 \usepackage{lipsum}
+\usepackage{listings}
 \usepackage{multicol}
 \usepackage{subcaption}
 \usepackage{verbatim}
@@ -26,6 +27,8 @@
 \setkomafont{disposition}{\normalfont\bfseries}
 \addtokomafont{descriptionlabel}{\normalfont\bfseries}
 
+\lstset{basicstyle=\footnotesize\ttfamily,breaklines=true}
+
 \title{ulo-storage}
 \subtitle{Indexing and Querying Organizational Data in Mathematical Libraries}
 \author{Andreas Schärtl (\texttt{ru64tiji})}
-- 
GitLab