Skip to content
Snippets Groups Projects
Commit 7bd2428d authored by Valerian Wintner's avatar Valerian Wintner
Browse files

Subgraph-query.

parent 2ab8ad29
No related branches found
No related tags found
1 merge request!16Kristina report
No preview for this file type
......@@ -176,7 +176,17 @@ The framework was implemented in \emph{Java}. We used \emph{Maven} as a project
\subsection{Fetching Knowledge Graphs}
Because \emph{knowledge graphs} can be very large and contain many nodes, we concentrated on fetching smaller subgraphs and only working on those. With this method, the relevant subgraph gets extracted from a \emph{knowledge graph} and can be worked upon in isolation.
We take our initial \emph{knowledge graphs} from the \emph{CommonCrawl} datasets and import them as a static file.
\todo{Explain query magic that fetches the graph here}\\
\todo{Explain query magic that fetches the graph here}
\Valerian{Figure~\ref{fig:query_construct_subgraph} shows the query we used to create this subgraph. At line 7 we used \emph{property paths}\footnote{\url{https://www.w3.org/TR/2013/REC-sparql11-query-20130321/\#propertypaths}} to query all nodes connected to those of an initial subset (lines 10 to 13). This subset can optionally be limited to a certain size, but is always limited to nodes of a certain type.}
\begin{figure}
\centering
\lstinputlisting{code_snippets/subgraph.sparql}
\caption{The \emph{SPARQL}-query creating the subgraph. The \emph{\%s} get substituted before executing the query.}
\label{fig:query_construct_subgraph}
\end{figure}
\Valerian{Missing: Subsection about generating subgraph (with limit), starting from a certain type of node.} \Kristina{Wouldn't this be part of Generating constraints? I feel like that doesn't really fit into technology stack}
\Danielle{I agree with Kristina here.}
......
CONSTRUCT {
?s ?p ?o
}
%s # %s replaced by optional graph-name
WHERE {
GRAPH ?g {
?subject (<>|!<>)* ?s .
?s ?p ?o .
{
SELECT DISTINCT ?subject
WHERE {
GRAPH ?g { ?subject a %s } # %s replaced by type of starting-nodes
} %s # %s replaced by optional limit
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment