Skip to content

Commit

Permalink
Add javadoc string
Browse files Browse the repository at this point in the history
  • Loading branch information
nck-mlcnv committed Jan 24, 2025
1 parent d70c344 commit 652d9d6
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,28 @@
import java.util.stream.IntStream;
import java.util.stream.Stream;

/**
* This class is responsible for handling query templates.
* Query templates are queries containing placeholders for some terms.
* Replacement candidates are identified by querying a given endpoint.
* The placeholders are written in the form of <code>%%var[0-9]+%%</code>, where <code>[0-9]+</code>
* represents any number.
* <p>
* Exemplary template: </br>
* <code>SELECT * WHERE {?s %%var1%% ?o . ?o &lt;http://exa.com&gt; %%var2%%}</code><br/>
* This template will then be converted to: <br/>
* <code>SELECT ?var1 ?var2 {?s ?var1 ?o . ?o &lt;http://exa.com&gt; ?var2}</code><br/>
* and will request query solutions from the given sparql endpoint (e.g DBpedia).<br/>
* The solutions will then be instantiated into the template.
* The result may look like the following:<br/>
* <code>SELECT * WHERE {?s &lt;http://prop/1&gt; ?o . ?o &lt;http://exa.com&gt; "123"}</code><br/>
* <code>SELECT * WHERE {?s &lt;http://prop/1&gt; ?o . ?o &lt;http://exa.com&gt; "12"}</code><br/>
* <code>SELECT * WHERE {?s &lt;http://prop/2&gt; ?o . ?o &lt;http://exa.com&gt; "1234"}</code><br/>
* The template data that this class returns will contain a list of all queries,
* where the first queries are the original queries including the query templates.
* The query instances will be appended to the original queries.
* The queryData is later used to keep track of the queries, their types, ids, and relations.
*/
public class QueryTemplateHandler {
private record TemplateData(List<String> queries, int templates, int[] indices, int[] instanceNumber, int instanceStart) {}

Expand Down

0 comments on commit 652d9d6

Please sign in to comment.