-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathclorm.tex
56 lines (53 loc) · 1.92 KB
/
clorm.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
% ----------------------------------------------------------------------
\begin{frame}{\clorm}
\begin{itemize}
\item \structure{Idea} \
\begin{itemize}
\item simplify working with ASP facts via a \python\ library
\item simplify \python-\clingo\ integration for easy refactoring and debugging
\end{itemize}
\item \structure{Features} \
\begin{itemize}
\item \python\ classes to define the mapping to \clingo\ predicates
\item functions to import/export \clingo\ solver facts
\item specialized container class with an intuitive query language
\end{itemize}
\item \structure{Technology} \ \clingo\ (\python\ API)
% \item \structure{Documentation} \url{https://clorm.readthedocs.io}
% \item \structure{Source} \url{https://github.com/potassco/clorm}
\item \structure{Origin} \ Made at Potassco Solutions Australia
\end{itemize}
\end{frame}
% ----------------------------------------------------------------------
\begin{frame}[fragile]{Example}
\begin{itemize}
\item Given ASP facts with a common predicate signature:
\par
\begin{lstlisting}[language=clingo,basicstyle=\small\ttfamily]
assign("Bob", task1). assign("Bob", task3).
assign("Bill", task2).
\end{lstlisting}
\item Use a Python class to specify the mapping:
\par
\begin{lstlisting}[language=Python, basicstyle=\small\ttfamily]
class Assign(Predicate):
person: str
task: ConstantStr
\end{lstlisting}
\item Then easily query a set of facts stored in a \emph{FactBase} container:
\par
\begin{lstlisting}[language=Python, basicstyle=\small\ttfamily]
query = factbase.query(Assign) \
.where(Assign.person == "Bob") \
.order_by(Assign.task)
for assign in query.all():
print(assign)
\end{lstlisting}
\end{itemize}
\end{frame}
% ----------------------------------------------------------------------
%
%%% Local Variables:
%%% mode: latex
%%% TeX-master: "../../main"
%%% End: