Last active
June 11, 2024 11:54
-
-
Save vsimko/fcc84e1e4f8e750746caa34b802db5a7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\documentclass{article} | |
\usepackage[dvipsnames]{xcolor} % https://en.wikibooks.org/wiki/LaTeX/Colors | |
\definecolor{LightGray}{rgb}{0.97,0.97,0.97} | |
\usepackage{listings} % syntax highlighting | |
\lstdefinelanguage{SPARQL}{ | |
basicstyle=\small\ttfamily, | |
backgroundcolor=\color{LightGray}, | |
columns=fullflexible, | |
breaklines=false, | |
sensitive=true, | |
% -------------------------- | |
frame=bt, | |
aboveskip=1em, | |
belowskip=1em, | |
xleftmargin=.5em, | |
xrightmargin=.5em, | |
framexleftmargin=.5em, | |
framextopmargin=.5em, | |
framexbottommargin=.5em, | |
framexrightmargin=.5em, | |
% -------------------------- | |
tabsize = 2, | |
showstringspaces=false, | |
morecomment=[l][\color{gray}]{\#}, % comments | |
morecomment=[n][\color{blue}]{<http}{>}, % uris | |
morestring=[b][\color{OliveGreen}]{\"}, % strings | |
% -------------------------- variables | |
keywordsprefix=?, | |
classoffset=0, | |
keywordstyle=\color{Sepia}, | |
morekeywords={}, | |
% -------------------------- prefixes | |
classoffset=1, | |
keywordstyle=\color{Purple}, | |
morekeywords={rdf,rdfs,owl,xsd,purl}, | |
% -------------------------- keywords | |
classoffset=2, | |
keywordstyle=\color{MidnightBlue}, | |
morekeywords={ | |
SELECT,CONSTRUCT,DESCRIBE,ASK,WHERE,FROM,NAMED,PREFIX,BASE,OPTIONAL, | |
FILTER,GRAPH,LIMIT,OFFSET,SERVICE,UNION,EXISTS,NOT,BINDINGS,MINUS,a | |
} | |
} | |
\begin{document} | |
\begin{lstlisting}[language=SPARQL] | |
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> | |
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> | |
# this is a comment | |
SELECT ?url ?name | |
WHERE { | |
?url rdf:type java:Package . | |
?url rdfs:label ?name . | |
FILTER( match(?name, "hello" )) | |
} | |
\end{lstlisting} | |
\end{document} |
Thanks! You saved me an hour of work!
This is perfect. Thanks 💯
glad to hear that
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks for the gist!