From 036dae9ded9ac568cff80cc69f0ee24366af742e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andreas=20Sch=C3=A4rtl?= <andreas@schaertl.me>
Date: Wed, 23 Sep 2020 15:32:42 +0200
Subject: [PATCH] report: applications: move code into a floating figure

---
 doc/report/applications-q3.tex | 45 ++++++++++++++++++++++++++++++++++
 doc/report/applications.tex    | 45 ++++++++++------------------------
 2 files changed, 58 insertions(+), 32 deletions(-)
 create mode 100644 doc/report/applications-q3.tex

diff --git a/doc/report/applications-q3.tex b/doc/report/applications-q3.tex
new file mode 100644
index 0000000..4ba29f4
--- /dev/null
+++ b/doc/report/applications-q3.tex
@@ -0,0 +1,45 @@
+\begin{figure}
+    \centering
+    \begin{subfigure}[]{0.9\textwidth}
+        \begin{lstlisting}
+    PREFIX ulo: <https://mathhub.info/ulo#>
+    PREFIX dcterms: <http://purl.org/dc/terms/>
+
+    SELECT ?work
+    WHERE {
+        ?work dcterms:creator|dcterms:contributor "John Smith" .
+    }
+    GROUP BY ?work
+        \end{lstlisting}
+
+        \caption{SPARQL query that asks for all \texttt{work}s created
+          by an author named ``John Smith''. ULO~does not come with
+          predicates for creator or contributor, instead the available
+          data sets take advantage of the \texttt{dcterms}
+          namespace~\cite{dcowl}.}\label{fig:q2a}
+    \end{subfigure}
+    \vspace{0.5cm}
+
+    \begin{subfigure}[]{0.9\textwidth}
+        \begin{lstlisting}
+    PREFIX ulo: <https://mathhub.info/ulo#>
+    PREFIX dcterms: <http://purl.org/dc/terms/>
+
+    SELECT ?work (COUNT(?user) as ?refcount)
+    WHERE {
+        ?work dcterms:creator|dcterms:contributor "John Smith" .
+        ?user ulo:uses ?work .
+    }
+    GROUP BY ?work
+    ORDER BY DESC(?refcount)
+        \end{lstlisting}
+
+        \caption{An adapted SPARQL~query based on~\ref{fig:q2a}. It
+          lists all works authored by ``John Smith'' rated by number
+          of references.  The idea is works that were referenced more
+          often are more important.}\label{fig:q2b}
+    \end{subfigure}
+
+    \caption{{SPARQL}~queries for answering questions about authorship
+      and main contributions.}\label{fig:q2full}
+\end{figure}
diff --git a/doc/report/applications.tex b/doc/report/applications.tex
index f8f34d7..3795bb9 100644
--- a/doc/report/applications.tex
+++ b/doc/report/applications.tex
@@ -236,38 +236,19 @@ of~$A$, that is those works that~$A$ authored that are the most
 important. Importance is a quality measure, simply sorting the
 result by number of references might be a good start.
 
-\noindent\textbf{Implementation} A 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:creator|dcterms:contributor "John Smith" .
-    }
-    GROUP BY ?work
-\end{lstlisting}
-    To get the main contributions, we rate each individual
-    \texttt{?work} by its number of \texttt{ulo:uses}
-    references. Extending the {SPARQL} query above, 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:creator|dcterms:contributor "John Smith" .
-        ?user ulo:uses ?work .
-    }
-    GROUP BY ?work
-    ORDER BY DESC(?refcount)
-\end{lstlisting}
-We can formulate~$\mathcal{Q}_3$ with just one SPARQL
-query. Because everything is handled by the database, access
-should be about as quick as we can hope it to be.
+\input{applications-q3.tex}
+
+\noindent\textbf{Implementation} A search for contributions by a given
+author can easily be formulated in {SPARQL}~(Figure~\ref{fig:q2a}).
+To get the main contributions, we rate each individual work
+by its number of \texttt{ulo:uses} references. Extending the previous
+{SPARQL}, we can query the database for a ordered list of works,
+starting with the one that has the most
+references~(Figure~\ref{fig:q2b}).  We can formulate~$\mathcal{Q}_3$
+with just one SPARQL query. Because everything is handled by the
+database, access should be about as quick as we can hope it to be.
+
+\subsubsection{Summarizing $\mathcal{Q}_1$ to $\mathcal{Q}_3$}
 
 Experimenting with $\mathcal{Q}_1$ to $\mathcal{Q}_3$ provided us with
 some insight into ULO and existing ULO exports. $\mathcal{Q}_1$ shows
-- 
GitLab