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 questionverbose
: specification of the verboselanguage
: language of the natural language questionqueryString
: the generated string corresponding to the SPARQL queryqueryXMLString
: the generated XML string corresponding to the SPARQL queryqueryAnswers
: the list of answers correspong to the queryselectPart
: array containing the information related to the select part of the querywherePart
: array containing the information related to the where part of the queryaggregation
: structure recording the presence of aggregation operatorsconjunction
: boolean indicated if the semantic entities are in conjunctionsentences
: sentences of the natural language questionnegation
: structure recording the negated semantic entitiesvarPrefix
: prefix of the SPARQL variablevariableCounter
: counter of the variables (mainly used to define new variable in the query)variableSet
: Set of the variables defined in the queryunion
: structure recording the semantic entities on which the union operator is appliedsemanticCorrespondance
: structure containing the semantic correspondance and the rewriting rulesquestionTopic
: semantic type referring to the question topicsemFeaturesIndex
: index of the semantic typessortedSemanticUnits
: sorted array of the semantic entities of the natural language questionconfig
: 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.