metaphacts / semopenalex

43 stars 6 forks source link

activate simple FTS (Full-Text Search, onto:fts) in the SPARQL endpoint #95

Closed sebferre closed 5 months ago

sebferre commented 6 months ago

Would it be possible to activate the "Simple Full-Text Search" of GraphDB? It would allow to search for any kind of entity by name in a uniform and light way into SPARQL queries, compared to the SERVICE I have seen, where the candidate types must be specified. It seems easy to configure GraphDB for a simple literal-based Lucene index: https://graphdb.ontotext.com/documentation/10.1/full-text-search.html.

My use case is Sparklis, a generic query builder for SPARQL endpoints. It already supports similar mechanisms in Virtuoso (bif:contains) and Jena Fuseki (text:query), and I plan to cover the Lucene-based onto:fts of GraphDB. I need a solution that is agnostic of the ontology of the target endpoint.

linnaung commented 6 months ago

hi @sebferre , we have a dedicated search abstraction (based on lucene or elastic search) called entity lookup and keyword search and unfortunately, we do not index all entity types, however you could remove for example, keywordsearch:candidateType schema:CreativeWork ; from search services.

Sample query for entity lookup (for more details, https://www.semopenalex.org/resource/Help:EphedraEntityLookupService)

PREFIX Service: <http://www.metaphacts.com/ontologies/platform/service/>
PREFIX entitylookup: <http://www.metaphacts.com/ontologies/platform/service/entitylookup/>
PREFIX soa: <https://semopenalex.org/ontology/>
PREFIX skos: <http://www.w3.org/2004/02/skos/core#>
SELECT ?subject ?type WHERE {
  SERVICE Service:entityLookup {
    ?subject entitylookup:entityName "semopen";
             entitylookup:type ?type;
             entitylookup:limit 10 ;
             entitylookup:score ?score;
             entitylookup:rank ?rank.
  }
} ORDER BY DESC (?score) DESC (?rank) LIMIT 10

Sample query for keyword search (for more details, https://www.semopenalex.org/resource/Help:EphedraKeywordSearchService)

PREFIX soa: <https://semopenalex.org/ontology/>
PREFIX keywordsearch: <http://www.metaphacts.com/ontologies/platform/service/keywordsearch/>
PREFIX Service: <http://www.metaphacts.com/ontologies/platform/service/>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
SELECT DISTINCT * WHERE {
  SERVICE Service:keywordSearch {
    ?subject keywordsearch:query "Daniel Hook";
             keywordsearch:limit 1000;
             keywordsearch:score ?score;
             keywordsearch:type ?type.
  }
}
linnaung commented 5 months ago

closing the issue.