afs_sparql_select - AFS - Reference Guides

AFS Filters Description

Product
AFS
AFS_Version
7.11
Category
Reference Guides
language
English

The rdf sparql filter enables querying a triplestore with SPARQL queries. The output format complies with the SRX W3C format, documented at http://www.w3.org/TR/rdf-sparql-XMLres/. The main objective of this filter is to make contextualized SPARQL queries. For each document, information representing this document is extracted and added as a constraint on each SPARQL query to produce the final answer. This constraint is made with the SPARQL variable defined in the query. The filter forces a binding between a variable name and a value extracted from the current "document.

The filter is declared with the afs_sparql_select type. It is in the antidot-paf-rdf package. It is a processor filter.

This filter can be instantiated only once at any given moment. It will not read the "instances" parameter in the configuration.

The SPARQL Select filter specifications are described in the following table:

Parameter name

Mandatory

Type

Default

Description

base_triplestores_path

No

directory

N/A

It is the path to a folder which contains several pre-duplicated triplestores.

triplestore_path

No

directory

N/A

It is the path to a unique triplestore (disk or SPARQL end-point url).

rdf_layer

No

layer

No RDF loaded from layer

It is where to read an RDF layer to load in the triplestore at runtime (i.e. in process).

rdf_layers

No

list

Empty List

It is where to read a set of RDF layers to load in the triplestore at runtime (i.e. in process).

nb_clear

No

integer

1

When the triplestore is contextual, it is how many process methods are made before reinitializing the triplestore.

triplestores_tempdir

No

directory

$AFS7/afs_triplestores

It is the temp path where a filter works on some triplestore in disk mode.

binding_map

No

map

N/A

It defines the binding map, where keys are SPARQL variables names, and values are XPaths.

binding_map_type

No

map

N/A

It allows to force the type of a binding variable. Key is the name of the binding variable, Value can be 'uri' or 'literal'.

binding_map_datatype

No

map

N/A

It allows to force the datatype of a binding variable if binding_map_type defines a binding variable as a literal. Key is the name of the binding variable, Value is a CURIE.

binding_map_lang

No

map

N/A

It allows to force the language of a binding variable if binding_map_type defines a binding variable as a literal. Key is the name of the binding variable, Value is an ISO 639-1 language code.

construct_directories

No

directory_list

N/A

It is where to find the SPARQL construct queries to execute (.rq).

input_layer

Yes

layer

N/A

It is where to read the input XML document where XPaths are applied.

nsmap

No

map

Empty Map

Namespaces to interpret XPaths

output_layer

No

layer

SRX

It is where to write the result

rdf_directories

No

directory_list

Empty List

A list of directories containing rdf files (.owl, .rdf, .xml) to load in a triplestore

rdf_files

No

file_list

Empty List

A list of rdf files to load in a triplestore

sparql_directories

Yes

directory_list

N/A

Where to find the SPARQL queries to execute (.rq).

use_rdfs_inference

No

boolean

false

When set to 'true', apply automatically RDFs inferences.

use_mondeca_engine

No

boolean

false

Activate if the project contains Mondeca thesaurus with SPARQL inference encapsulated

force_rdf_format

No

string

auto-detected

Force input RDF format to avoid spending time in auto detection. Available values are: - RDF_XML, - TURTLE, - N_TRIPLES, - N3

show_binding_information

No

boolean

false

Show SPARQL variables binding for each result as an extension of the SRX output format. See note.

About the show_binding information parameter: Setting the parameter to "true" will produce the following result:
    <result afs:request="select.rq">
    <afs:bindings>
        <afs:binding name="node1">
            <afs:Literal xmlns:afs="http://ref.antidot.net/v7/afs#" data="Literal 1.1"/>
        </afs:binding>
        <afs:binding name="node2">
            <afs:Literal xmlns:afs="http://ref.antidot.net/v7/afs#" data="Literal 2.1"/>
        </afs:binding>
    </afs:bindings>
    <binding name="uri">
        <uri>http://test.fr/a</uri>
    </binding>
</result> 
    
WHERE node1 and node2 are binding variables from the "select.rq" request.