Faster implementation of TPF for SDB (#54)
* Initial performance improvements to TPF * Add faster counts for TPF * Correct end count * Bug fixes, use hashes for filtering * Initial LDF SPARQL client * Handle blank nodes correctly
This commit is contained in:
parent
0191ae6dbb
commit
b5da11c2be
17 changed files with 1446 additions and 112 deletions
43
api/src/main/resources/tpf/client.ftl.html
Normal file
43
api/src/main/resources/tpf/client.ftl.html
Normal file
|
@ -0,0 +1,43 @@
|
|||
<h2>Query from your browser</h2>
|
||||
<p>
|
||||
Your browser executes these queries locally
|
||||
using <a href="http://linkeddatafragments.org/in-depth/#tpf" target="_blank">Triple Pattern Fragments</a>.
|
||||
</p>
|
||||
<fieldset class="ldf-client">
|
||||
<ul>
|
||||
<li>
|
||||
<label>Query</label>
|
||||
<textarea class="queryText"></textarea>
|
||||
</li>
|
||||
<li>
|
||||
<button class="start" style="display: inline-block;">Execute query</button>
|
||||
<button class="stop" style="display: none;">Stop execution</button>
|
||||
<span class="timing"></span>
|
||||
</li>
|
||||
<!-- example queries -->
|
||||
<li>
|
||||
<label>Query results</label>
|
||||
<div class="results"><div class="text"></div><div class="scrollRunway" style="position: absolute; height: 1px; width: 1px; transition: transform 0.2s; -webkit-transition: transform 0.2s; transform: translate(0px, 0px);"> </div></div>
|
||||
</li>
|
||||
</ul>
|
||||
</fieldset>
|
||||
<link rel="stylesheet" href="${ assetsPath }ldf-client.css">
|
||||
<script>
|
||||
var ldfAssetsPath = '${ assetsPath }';
|
||||
</script>
|
||||
<script src="${ assetsPath }ldf-client-ui-packaged.js"></script>
|
||||
<script>jQuery(function($){$(".ldf-client").queryui(
|
||||
{
|
||||
"datasources": [
|
||||
<#if datasources??>
|
||||
<#list datasources?keys as datasourceName>
|
||||
{
|
||||
"name": "${datasources[datasourceName].getTitle() }",
|
||||
"url": "${homePath}/${datasourceName}"
|
||||
}<#if datasourceName?has_next>, </#if>
|
||||
</#list>
|
||||
</#if>
|
||||
]
|
||||
|
||||
}
|
||||
)})</script>
|
122
api/src/main/resources/tpf/examples.ftl.html
Normal file
122
api/src/main/resources/tpf/examples.ftl.html
Normal file
|
@ -0,0 +1,122 @@
|
|||
<li>
|
||||
<label>Example queries</label>
|
||||
<select class="query" style="display: none;"><option></option><option value="SELECT ?movie ?title ?name
|
||||
WHERE {
|
||||
?movie dbpedia-owl:starring [ rdfs:label "Brad Pitt"@en ];
|
||||
rdfs:label ?title;
|
||||
dbpedia-owl:director [ rdfs:label ?name ].
|
||||
FILTER LANGMATCHES(LANG(?title), "EN")
|
||||
FILTER LANGMATCHES(LANG(?name), "EN")
|
||||
}">Directors of movies starring Brad Pitt</option><option value="SELECT DISTINCT ?entity WHERE {
|
||||
?entity a dbpedia-owl:Airport;
|
||||
dbpprop:cityServed dbpedia:Italy.
|
||||
}">Airports in Italy</option><option value="SELECT ?name ?deathDate WHERE {
|
||||
?person a dbpedia-owl:Artist;
|
||||
rdfs:label ?name;
|
||||
dbpedia-owl:birthPlace [ rdfs:label "York"@en ].
|
||||
FILTER LANGMATCHES(LANG(?name), "EN")
|
||||
OPTIONAL { ?person dbpprop:dateOfDeath ?deathDate. }
|
||||
}">Artists born in York</option><option value="CONSTRUCT {
|
||||
?artist a dbpedia-owl:Artist.
|
||||
?artist dbpedia-owl:birthDate ?date.
|
||||
}
|
||||
WHERE {
|
||||
?artist dbpedia-owl:influencedBy dbpedia:Pablo_Picasso.
|
||||
?artist a dbpedia-owl:Artist.
|
||||
?artist dbpedia-owl:birthDate ?date.
|
||||
}">Artists influenced by Picasso</option><option value="SELECT DISTINCT ?book ?author
|
||||
WHERE {
|
||||
?book rdf:type dbpedia-owl:Book;
|
||||
dbpedia-owl:author ?author.
|
||||
}
|
||||
LIMIT 100">Authors of books</option><option value="SELECT ?award WHERE {
|
||||
?award a dbpedia-owl:Award;
|
||||
dbpprop:country [ dbpedia-owl:language dbpedia:Dutch_language ].
|
||||
}">Award ceremonies in Dutch speaking countries</option><option value="SELECT DISTINCT ?performer ?name WHERE {
|
||||
?work dbpedia-owl:writer dbpedia:Michael_Jackson;
|
||||
dbpedia-owl:musicalArtist ?performer.
|
||||
OPTIONAL {
|
||||
?performer rdfs:label ?name.
|
||||
FILTER LANGMATCHES(LANG(?name), "EN")
|
||||
}
|
||||
}">Bands Michael Jackson wrote a song for</option><option value="SELECT ?software ?company WHERE {
|
||||
?software dbpedia-owl:developer ?company.
|
||||
?company dbpedia-owl:locationCountry [ rdfs:label "Belgium"@en ].
|
||||
}">Belgian software</option><option value="PREFIX yago: <http://dbpedia.org/class/yago/>
|
||||
SELECT ?person
|
||||
WHERE {
|
||||
?person a yago:Carpenters, yago:PeopleExecutedByCrucifixion.
|
||||
}">Carpenters killed by crucifixion</option><option value="PREFIX dbpedia-owl: <http://dbpedia.org/ontology/>
|
||||
SELECT ?actor ?cause
|
||||
WHERE {
|
||||
?actor dbpedia-owl:deathCause ?cause.
|
||||
?actor dc:subject <http://dbpedia.org/resource/Category:American_male_film_actors>
|
||||
}">Death causes of male American actors</option><option value="SELECT ?dessert ?fruit
|
||||
WHERE {
|
||||
?dessert dbpedia-owl:type <http://dbpedia.org/resource/Dessert>;
|
||||
dbpedia-owl:ingredient ?fruit.
|
||||
?fruit dbpedia-owl:kingdom <http://dbpedia.org/resource/Plant>.
|
||||
}">Desserts made with plants</option><option value="SELECT DISTINCT ?device WHERE {
|
||||
dbpedia:Raspberry_Pi dbpprop:os ?operatingSystem.
|
||||
?device a dbpedia-owl:Device;
|
||||
dbpprop:os ?operatingSystem.
|
||||
FILTER (!(?device = dbpedia:Raspberry_Pi))
|
||||
}">Devices with the same OS as the Raspberry Pi</option><option value="SELECT DISTINCT ?entity ?event
|
||||
WHERE {
|
||||
?entity a dbpedia-owl:Event;
|
||||
rdfs:label ?event;
|
||||
?predicate <http://dbpedia.org/resource/Trentino> .
|
||||
FILTER(langMatches(lang(?event), "EN"))
|
||||
}">Events that took place in the Trentino region</option><option value="SELECT ?titleEng ?title
|
||||
WHERE {
|
||||
?movie dbpprop:starring [ rdfs:label "Natalie Portman"@en ];
|
||||
rdfs:label ?titleEng, ?title.
|
||||
FILTER LANGMATCHES(LANG(?titleEng), "EN")
|
||||
FILTER (!LANGMATCHES(LANG(?title), "EN"))
|
||||
}">Foreign titles of Natalie Portman movies</option><option value="SELECT ?indDish ?belDish ?ingredient
|
||||
WHERE {
|
||||
?indDish a dbpedia-owl:Food;
|
||||
dbpedia-owl:origin dbpedia:India;
|
||||
dbpedia-owl:ingredient ?ingredient.
|
||||
?belDish a dbpedia-owl:Food;
|
||||
dbpedia-owl:origin dbpedia:Belgium;
|
||||
dbpedia-owl:ingredient ?ingredient.
|
||||
}">Indian dishes that have ingredients in common with Belgian dishes</option><option value="SELECT DISTINCT ?artist ?band ?bandName WHERE {
|
||||
{ <http://dbpedia.org/resource/Queen_(band)> dbpedia-owl:bandMember ?artist. }
|
||||
UNION
|
||||
{ <http://dbpedia.org/resource/Queen_(band)> dbpedia-owl:formerBandMember ?artist. }
|
||||
?band dbpedia-owl:formerBandMember ?artist;
|
||||
rdfs:label ?bandName.
|
||||
FILTER (?band != <http://dbpedia.org/resource/Queen_(band)>)
|
||||
}">Other bands of Queen members</option><option value="SELECT DISTINCT ?person
|
||||
WHERE {
|
||||
dbpedia:Jesus dc:subject ?common.
|
||||
?person a foaf:Person;
|
||||
dc:subject ?common.
|
||||
}
|
||||
LIMIT 1000">People who have something in common with Jesus</option><option value="SELECT ?place ?relation
|
||||
WHERE {
|
||||
?place rdf:type dbpedia-owl:Settlement;
|
||||
?relation dbpedia:Barack_Obama;
|
||||
}">Places that have something to do with Barack Obama</option><option value="SELECT ?clubName ?playerName WHERE {
|
||||
?club a dbpedia-owl:SoccerClub;
|
||||
dbpedia-owl:ground ?city;
|
||||
rdfs:label ?clubName.
|
||||
?player dbpedia-owl:team ?club;
|
||||
dbpedia-owl:birthPlace ?city;
|
||||
rdfs:label ?playerName.
|
||||
?city dbpedia-owl:country dbpedia:Spain.
|
||||
|
||||
FILTER LANGMATCHES(LANG(?clubName), "EN")
|
||||
FILTER LANGMATCHES(LANG(?playerName), "EN")
|
||||
}">Soccer players born in their club's city</option><option value="SELECT ?entity ?label ?comment
|
||||
WHERE {
|
||||
?entity a dbpedia-owl:MythologicalFigure;
|
||||
rdfs:label ?label;
|
||||
dc:subject <http://dbpedia.org/resource/Category:Women_in_Greek_mythology>;
|
||||
rdfs:comment ?comment
|
||||
|
||||
FILTER(langMatches(lang(?label), "EN"))
|
||||
FILTER(langMatches(lang(?comment), "EN"))
|
||||
}">Women in Greek mythology</option></select><div class="chosen chosen-single" style="width: 430px;" title=""><a class="chosen-single chosen-default" tabindex="-1"><span> </span><div><b></b></div></a><div class="chosen-drop"><div class="chosen-search"><input type="text" autocomplete="off"></div><ul class="chosen-results"></ul></div></div>
|
||||
</li>
|
|
@ -12,10 +12,9 @@
|
|||
</#list>
|
||||
</#if>
|
||||
</dl>
|
||||
<p>The current dataset <em class="dataset">index</em> contains metadata about these datasets.</p>
|
||||
</div>
|
||||
|
||||
<#include "fragment.ftl.html">
|
||||
<#include "client.ftl.html">
|
||||
</#macro>
|
||||
|
||||
<@display_page/>
|
Loading…
Add table
Add a link
Reference in a new issue