Semantic Full-Text Search on Freebase and Wikpedia is also available through our API

Broccoli's query language is similar to SPARQL but still has some unnecessary differences. We are working on improving that and making it more standard. Eventually, we will fully describe the language. In the following, we describe the basic features of our query language. For examples and advances features it is always a good idea to use the debug log button in the interactive demo and inspect the API query sent internally (the button is hidden in the upper right corner of the UI, it get's visible when the mouse cursor is moved there).

Broccoli Queries are very similar to SPARQL queries. They consist of triples. Variables are marked using a $ sign. One variable has to be explicitly marked as the root node. Typical triples are of the form "VAR RELATION VAR". In addition there are some relations with special semantics:

In addition to the query language, the results delivered by our API can be controlled through various HTTP parameters that are listed below.

Here is a link to an example API query.

API Parameters

HTTP Parameter Functionality Default or Example Value
s The semantic query. $1 is-a Person;$1 occurs-with algorith*
query A variable from the semantic query s, which is the root node of the given query. $1
prefix A prefix to filter all suggestions with. Can be used with or without the parameters s and query. pers
sortby Provide a variable from the semantic query s that is connected to the root variable. The result will be sorted by the values for this variable rather than by the normal scoring. Can be used to sort buildings by height, etc. See the corresponding entry in the feature list. $2
order Specifies if the sortby order should be ascending or descending. descending
jsonp Provide the result as jsonp instead of the default XML. false
nofwords The number of word suggestions to send. There are only word suggestions if a prefix with a length of at least 4 characters is given. 10
firstword The index of the first word to send. If there are 100 words in total and one wants to load words 10-20, nofwords=10 and firstword=10 does the trick. To start in the beginning, use firstword=0. This is also the default. 0
nofinstances The number of instance proposals to send. Like nofwords but does not require a prefix. 10
firstinstance See firstword. 0
nofrelations Like nofinstances but for relation suggestions. 10
firstrelation See above. 0
nofclasses See above. 10
firstclass See above. 0
nofhitgroups The number of hitgroups to send. hitgroups correspond to the large hits on the right-hand-side of the UI. Each hitgroup features several excerpts. Do not set this parameter too high. Each excerpt has to be read from disk and we block requests that are too expensive to process. 10
firsthitgroup See above. 0
nofexcerptsperowtriple If your query contains occurs-with triples, this is where actual full-text is processed. In order to get several hits for the same entity, this parameter can be increased (this is done by the UI when the hidden show more button at the bottom of each hit gets clicked). 1
hooisactive Used flag to get different word suggesions. Usually word suggestions are for words that occur together with solutions to the current query. However, solutions can also be documents. This flag indicates that words within those documents should be suggested. false