This library and command line interface (CLI) start a server that offers a search API on top of knowledge graphs.
A lot of knowledge graph are hosted on the Web where IRIs are used to uniquely identify resources. In certain use cases when looking for the IRI of a specific resource users want to search for it based on its label or description. This library and CLI offer such a search functionality on top of these knowledge graphs. It starts a server that accepts a single GET request with the searched term.
- Install Searchbee via
npm -g i searchbee
. - Either start a server or generate an index.
- Execute Searchbee via
searchbee server -s [sources]
wheresources
is a comma-separated list of sources, such as TPF servers, RDF files, and SPARQL endpoints. - Search for the resources via
curl http://localhost:8080/?q=[term]
whereterm
is the search term. The output is a JSON array with the IRIs of the matched resources.
The search index is by default build based on the triples with predicate
http://www.w3.org/2000/01/rdf-schema#label
.
This is overwritten through the option -l, --label
.
The search index considers by default all resources that are found.
This is overwritten through the option --resources
.
In this case the index only considers the resources that match the sources.
For example, if your sources are http://example.org/A
and http://example.org/B
,
then the index is built only with triples about these two resources.
Even if the sources return for example triples about http://example.org/C
.
searchbee server -s https://ruben.verborgh.org/profile/#me
starts a server based on the data athttps://ruben.verborgh.org/profile/#me
.curl http://localhost:8080/?q=ruben
searches for resources mentioning "ruben".
By generating an index before staring the server allows you to reuse the index when restarting the server. This removes the need to create the index every time you start the server, which might be time-consuming for big sources.
-
Execute Searchbee via
searchbee index -s [sources] -f [path]
wheresources
is a comma-separated list of sources, such as TPF servers, RDF files, and SPARQL endpoints, andpath
points to the file that stores the index. -
Execute Searchbee via
searchbee server -f [path]
wherepath
points to the file that stores the index.
searchbee index -s https://ruben.verborgh.org/profile/#me -f index.json
generates an index based on the data athttps://ruben.verborgh.org/profile/#me
and stores in the fileindex.json
.searchbee server -f index.json
starts a server based on the index inindex.json
.
- Install dependencies via
npm i
. - Make changes.
- Execute Searchbee via
node ./bin/cli.js
.
We use Vale to lint the documentation.
- Install Vale.
- Execute
npm run lint:docs
to lint the documentation.
ยฉ 2020 Pieter Heyvaert, MIT License