When using SPARQL in Exaptive, everything should feel very familiar to working with SPARQL outside of Exaptive, assuming that you're using some language-based driver. The first thing you'll need to do is find a SPARQL driver that works for the Exaptive language domain you're working in. For example, SPARQLWrapper is a python package that should afford you the core functionality of SPARQL inside an Exaptive component.
Here is a look at a general python SPARQL component written in python.
Here are considerations for you while you work with a SPARQL driver inside an Exaptive component.
- Where possible, try to limit query time to avoid component timeouts. Very long running SPARQL queries will be perceived as a non-response from the python component. As an alternative, try to break queries up into consecutive, small queries.
- As a rule of thumb, try to format any returned data from queries into the Exaptive data model when sending anything through an output port. As in the example above, I'm taking the data and putting them into an entity based data model and explicitly putting that into the exaptive data model to play well with other components.
- For reusability, allow for configuration of query parameters as well as allowing for configuration of the host url.