Semantic-Society / Recommender

MIT License
0 stars 0 forks source link

Neologism Recommender

This repository contains the recommender used for neologism2. It is used for both class and property recommendations.

Recommending classes

It is also possible to add more proxies, more local vocabularies, and more endpoints.

Now, these different backend recommenders have different speeds. The local vocabulary recommender precomputes all answers iand is hence near instant. Others take longer. To get quick results for the application using this system a couple of measures are taken:

Results are cached, also the context is cached so that things do not have to get parsed again. REquests will timeout if downstream recommenders are too slow.

Results are provided in chunks. this works as follows:

Input to the recommender

The model parameter

The recommender expects two pieces of information. The searchstring and a serialization of the graph in which the class occurs (the context)

For example, given the following graph, where the recommenderInput is askign a recommendation for the string "jag"

The graph send to the recommender can be serialized as:

@prefix ex: <http://example.com/> .
ex:Lion a ex:Animal .
ex:HouseCat a ex:Animal .
<neo://query/jag> a ex:Animal .

Note that we use turtle serialization, so we can write a instead of rdf:type. The query string is embedded in the graph. As in a normal RDF graph serialization, it could occur multiple times if more relations are defined. If used as a GET request, the graph needs to be URL encoded: %40prefix%20ex%3A%20%3Chttp%3A%2F%2Fexample.com%2F%3E%20.%0Aex%3ALion%20a%20ex%3AAnimal%20.%0Aex%3AHouseCat%20a%20ex%3AAnimal%20.%0A%3Cneo%3A%2F%2Fquery%2Fjag%3E%20a%20ex%3AAnimal%20.%0A

In case the class is not yet connected to anything in the graph, it is also possible to send the model and the searchstriong separately. For this case, the model argument is provided as a POST body. For the normal request, this is not implemented, yet.

Internals