Sparnatural
Sparnatural copied to clipboard
Please support Jena Full Text Search in AutoCompleteWidget
Please support Jena Full Text Search in AutoCompleteWidget.
There are a lot of sparql resources implemented with Apache Jena out there.
Apache Jena has an extension to ARQ called Jena Full Text Search combining SPARQL and full text search via Lucene. It gives applications the ability to perform indexed full text searches within SPARQL queries way more faster than with reqular SPARQL.
See: https://jena.apache.org/documentation/query/text-query.html
I did´t get it to implement the following queries in the typescript syntax of sparqljs to implement it by myself...
How do I map parentheses within the subject?
Example query for Autocomplete-Search:
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xml: <http://www.w3.org/XML/1998/namespace>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
PREFIX text: <http://jena.apache.org/text#>
PREFIX config-datasources: <http://data.sparna.fr/ontologies/sparnatural-config-datasources#>
PREFIX config-core: <http://data.sparna.fr/ontologies/sparnatural-config-core#>
SELECT DISTINCT ?uri ?label ?blankType
WHERE {
{
SELECT DISTINCT ?uri ?score WHERE {
(?uri ?score) text:query (rdfs:label "Bayer") .
?uri a/rdfs:subClassOf* <https://schema.coypu.org/global#Company> .
}
ORDER BY DESC(?score)
LIMIT 100 OFFSET 0
}
OPTIONAL {?uri rdf:type ?foundClass}
BIND (coalesce(?foundClass, owl:Thing) as ?class)
OPTIONAL {?uri rdfs:label|skos:prefLabel ?label}
} ORDER BY DESC(?score)
If I find and select data I´d like to filter it by its URI
and not by its selected property like label
like:
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?uri ?label
WHERE {
?uri rdf:type <https://schema.coypu.org/global#Company>;
FILTER (?uri = <https://data.coypu.org/company/gleif/52990063JAR3WYTRS232>)
OPTIONAL {?uri rdf:type ?foundClass}
BIND (coalesce(?foundClass, owl:Thing) as ?class)
OPTIONAL {?uri rdfs:label|skos:prefLabel ?label}
}