NAME

RDF::NLP::SPARQLQuery::Query - Perl extension for representing the SPARQL query.

SYNOPSIS

use RDF::NLP::SPARQLQuery::Query;

my $query = RDF::NLP::SPARQLQuery::Query->new( 'verbose' => 0, 'docId' => $docId, 'language' => uc($language), 'sentences' => \@sentences, 'negation' => \%negation, 'union' => \@union, 'aggregation' => \%aggregation, 'semanticCorrespondance' => \%semanticCorrespondance, 'semFeaturesIndex' => \%semFeaturesIndex, 'sortedSemanticUnits' => \@sortedSemanticUnits, 'config' => \%config, );

$query->queryConstruction($questionTopic);

$query->queryGeneration;

DESCRIPTION

This object represents the SPARQL query and provides methods to perform the query construction and the query generation. The representation of the query includes several fields:

  • docId: identifier of the natural language question

  • verbose: specification of the verbose

  • language: language of the natural language question

  • queryString: the generated string corresponding to the SPARQL query

  • queryXMLString: the generated XML string corresponding to the SPARQL query

  • queryAnswers: the list of answers correspong to the query

  • selectPart: array containing the information related to the select part of the query

  • wherePart: array containing the information related to the where part of the query

  • aggregation: structure recording the presence of aggregation operators

  • conjunction: boolean indicated if the semantic entities are in conjunction

  • sentences: sentences of the natural language question

  • negation: structure recording the negated semantic entities

  • varPrefix: prefix of the SPARQL variable

  • variableCounter: counter of the variables (mainly used to define new variable in the query)

  • variableSet: Set of the variables defined in the query

  • union: structure recording the semantic entities on which the union operator is applied

  • semanticCorrespondance: structure containing the semantic correspondance and the rewriting rules

  • questionTopic: semantic type referring to the question topic

  • semFeaturesIndex: index of the semantic types

  • sortedSemanticUnits: sorted array of the semantic entities of the natural language question

  • config: structure containing the configuration of the converter

METHODS

queryConstruction()

queryConstruction($questionTopic);

The method performs the construction step of the query, after the question abstraction. The objective of the query construction step is to build a representation of the SPARQL graph pattern from the elements identified during the question abstraction step. The question topic field is also set with $questionTopic. Then it is used to define the select part.

queryGeneration()

queryGeneration();

The method generates the string corresponding to the query.

getQueryAnswers()

getQueryAnswers();

The method build the answers corresponding to the queries by sending the generated SPARQL query to a Virtoso server.

wherePart()

wherePart();

This methods sets the empty array representing the where part of the query.

SEE ALSO

Documentation of the module RDF::NLP::SPARQLQuery

AUTHORS

Thierry Hamon, <hamon@limsi.fr>

LICENSE

Copyright (C) 2014 by Thierry Hamon

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.1 or, at your option, any later version of Perl 5 you may have available.