System-wide components in the QALL-ME Framework are WS components which are neither language nor location dependent and which can thus be implemented only once and then be used system-widely. The core framework brings implementations for all system-wide components. These implementations can either be used directly or they can be modified to suit specific needs; the Java source code of all component implementations is freely available (cf. 4.1).
The LanguageIdentifier
is a WS
which provides a single web method for the identification of the language of a
given natural language text string. Its WSDL description can
be found under src/main/net/sf/qallme/res/wsdl/languageidentification.wsdl
. The
system-wide framework implementation in Java is the class net.sf.qallme.LanguageIdentifierWSProvider
.
The LanguageIdentifier
has the following web
methods:
The getLanguage
web method tries to determine the
language of a given natural language text string. The identified language is
represented as a two-letter, lower-case ISO 639-1 alpha-2 language code.
Implementations may return “UND” (cf. RFC 3066) as the language code if
they absolutely cannot identify the language of the given text, e.g., for an
empty input text string. However, this should only be done if really in doubt,
not if just unsure. In reverse, the caller of this web method should know this
policy and must be aware that 100 % correct results are not always possible
in language identification.
Sample request (SOAP body):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:qal="http://qallme.sf.net/wsdl/qallmeshared.wsdl"> <qal:string>¿Qué películas puedo ver en el cine Schmelzer Lichtspiele?</qal:string> </soapenv:Body>
Sample response (SOAP body):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <languageCode xmlns="http://qallme.sf.net/wsdl/qallmeshared.wsdl">es</languageCode> </soapenv:Body>
The QAPlanner
is a WS which
encapsulates a complete QA system based on the
QALL-ME Framework. Its main operation is the
answerQuestion
web method which returns an
RDF answer graph for a
given natural language question string with spatiotemporal context. The
WSs which are used in the underlying QA
subsystems can be exchanged at runtime. The QAPlanner
’s
WSDL description can be found under src/main/net/sf/qallme/res/wsdl/qaplanner.wsdl
. The system-wide
framework implementation in Java is the class net.sf.qallme.QAPlannerWSProvider
.
The QAPlanner
has the following web methods:
The answerQuestion
web method is the main
operation of the QAPlanner
. It returns an
RDF answer graph for a given inquiry consisting of a natural
language question string and the spatiotemporal context of the question. If the
question cannot be answered for some reason, then an empty RDF
graph is returned.
Sample request (SOAP body):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <qap:inquiry xmlns:qap="http://qallme.sf.net/xsd/qaplanner.xsd" xmlns:qal="http://qallme.sf.net/xsd/qallmeshared.xsd"> <qap:question>Was für eine Art von Film ist Dreamgirls?</qap:question> <qal:spatiotemporalContext> <qal:location lat="49.256409" lon="7.042437">DE</qal:location> <qal:time>2007-03-18T12:58:21</qal:time> </qal:spatiotemporalContext> </qap:inquiry> </soapenv:Body>
Sample response (SOAP body):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <RDFGraph xmlns="http://qallme.dfki.de/xsd/qallmeshared.xsd"> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:qma="http://qallme.fbk.eu/ontology/qallme-answers.owl#" xmlns:qmo="http://qallme.itc.it/ontology/qallme-tourism.owl#"> <qma:AnswersObject rdf:about="http://qallme.fbk.eu/ontology/qallme-answers.owl#AnswerInstance"> <qma:hasAnswerValue> <rdf:Description rdf:about="http://qallme.itc.it/ontology/qallme-tourism.owl#Genre_musical"> <qmo:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">musical</qmo:name> </rdf:Description> </qma:hasAnswerValue> <qma:hasAnswerValue> <rdf:Description rdf:about="http://qallme.itc.it/ontology/qallme-tourism.owl#Genre_drama"> <qmo:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">drama</qmo:name> </rdf:Description> </qma:hasAnswerValue> </qma:AnswersObject> <qmo:Movie rdf:about="http://qallme.itc.it/ontology/qallme-tourism.owl#Movie_DFKI_5934"> <qmo:hasGenre rdf:resource="http://qallme.itc.it/ontology/qallme-tourism.owl#Genre_musical"/> <qmo:name rdf:datatype="http://www.w3.org/2001/XMLSchema#string">Dreamgirls</qmo:name> <qmo:hasGenre rdf:resource="http://qallme.itc.it/ontology/qallme-tourism.owl#Genre_drama"/> </qmo:Movie> </rdf:RDF> </RDFGraph> </soapenv:Body>
The setComponent
web method tells the
QAPlanner
to use a given component implementation for
QA. The method must be used for initializing the
QAPlanner
with all component implementations it shall
manage. The method may be used again later to replace a certain component
implementation with another one. If any part of the request is not valid or if
the given WS implementation cannot be invoked, then an
IllegalArgumentFault is thrown.
Each component implementation is specified by the URL of
its WSDL description (cf. <wsdlURL>
in the request). Additionally the caller has to specify
which type of component shall be set with the given implementation (cf. <componentID>
). This component type is determined by
the namespace of the respective component’s WSDL definition.
There are three possible ways for writing a request to the
setComponent
web method; the caller has to choose one
of these three based on whether a system-wide component shall be set or a
language or location specific component shall be set.
Sample request (SOAP body) for setting a language specific component implementation:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <qap:ComponentSetupRequest xmlns:qap="http://qallme.sf.net/wsdl/qaplanner.wsdl"> <componentID>http://qallme.sf.net/wsdl/querygeneration.wsdl</componentID> <componentLang>de</componentLang> <wsdlURL>http://localhost:8080/qmfdemo/de-querygeneration/QueryGeneratorWS?wsdl</wsdlURL> </qap:ComponentSetupRequest> </soapenv:Body>
<componentLang>
element has to be used for
setting a language specific component implementation. Its value has to be the
ISO 639-1
alpha-2 code of the language for which the implementation shall be used.
Sample request (SOAP body) for setting a location specific component implementation:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <qap:ComponentSetupRequest xmlns:qap="http://qallme.sf.net/wsdl/qaplanner.wsdl"> <componentID>http://qallme.sf.net/wsdl/answerpool.wsdl</componentID> <componentLoc>ES</componentLoc> <wsdlURL>http://localhost:8080/qmfdemo/ES-answerpool/AnswerPoolWS?wsdl</wsdlURL> </qap:ComponentSetupRequest> </soapenv:Body>
<componentLoc>
element has to be used for
setting a location specific component implementation. Its value has to be the
ISO 3166-1
alpha-2 code of the country for which the implementation shall be used.
Sample request (SOAP body) for setting a system-wide component implementation:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <qap:ComponentSetupRequest xmlns:qap="http://qallme.sf.net/wsdl/qaplanner.wsdl"> <componentID>http://qallme.sf.net/wsdl/languageidentification.wsdl</componentID> <systemWideComponent/> <wsdlURL>http://localhost:8080/qmfdemo/languageidentification/LanguageIdentifierWS?wsdl</wsdlURL> </qap:ComponentSetupRequest> </soapenv:Body>
<systemWideComponent>
element has to flag this.
Sample response (SOAP body):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <ns4:dummy xsi:type="xs:string" xmlns:ns4="http://qallme.sf.net/xsd/qallmeshared.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema"/> </soapenv:Body>
The getSubsystemComponents
web method returns all
component WS implementations which are currently used in the
QAPlanner
for a given language/location subsystem or as
system-wide components. A flag in the return result (cf. complete
attribute) additionally shows whether all components for the
given subsystem are already set or not. The identifier for the subsystem in a
request to the method has the same form as the parameter of the setComponent
web method.
If only a single WS implementation of a certain component
type that is currently used in the QAPlanner
shall be
returned, then the getComponent
web method can be used
instead.
Sample request (SOAP body) for getting all component implementations of a certain language subsystem:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <qap:ComponentSetupRequest xmlns:qap="http://qallme.sf.net/wsdl/qaplanner.wsdl"> <componentLang>de</componentLang> </qap:ComponentSetupRequest> </soapenv:Body>
setComponent
web method.
Sample response (SOAP body):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <ns2:SubsystemComponentSetup complete="false" xmlns:ns2="http://qallme.sf.net/wsdl/qaplanner.wsdl"> <component id="http://qallme.sf.net/wsdl/termannotation.wsdl">http://localhost:8080/qmfdemo/de-termannotation/TermAnnotatorWS?wsdl</component> <component id="http://qallme.sf.net/wsdl/timeannotation.wsdl">http://localhost:8080/qmfdemo/de-timeannotation/TimeAnnotatorWS?wsdl</component> </ns2:SubsystemComponentSetup> </soapenv:Body>
complete
attribute
flags that not all required component implementations for the requested subsytem
have been set, yet. In particular the QueryGenerator
component implementation has not been set, yet.
The getComponent
web method returns the
URL of the WSDL document of a certain
component implementation which is currently used in the
QAPlanner
. The desired component is identified by its
WSDL namespace and a marker for the language/location
subsystem or a flag for system-wide components. This identifier has the same
form as the parameter of the setComponent
web method.
Sample request (SOAP body) for getting a certain language specific component implementation:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <qap:ComponentSetupRequest xmlns:qap="http://qallme.sf.net/wsdl/qaplanner.wsdl"> <componentID>http://qallme.sf.net/wsdl/querygeneration.wsdl</componentID> <componentLang>de</componentLang> </qap:ComponentSetupRequest> </soapenv:Body>
setComponent
web method.
Sample response (SOAP body):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <ns5:uri xmlns:ns5="http://qallme.sf.net/wsdl/qallmeshared.wsdl">http://localhost:8080/qmfdemo/de-querygeneration/QueryGeneratorWS?wsdl</ns5:uri> </soapenv:Body>
The Timex2SparqlConverter
is a
WS which has a single web method that converts the temporal
information from a piece of text which is annotated in the extended TIMEX2
format (cf. 4.2.1: “General Remarks”) to parts of a SPARQL
query. Standard TIMEX2 annotations will result in a time point disjunction
SPARQL query and two annotations with extended TIMEX2
annotations are considered to be start and end points of an interval. The
Timex2SparqlConverter
’s WSDL
description can be found under src/main/net/sf/qallme/res/wsdl/timex2sparqlconversion.wsdl
. The
system-wide framework implementation in Java is the class net.sf.qallme.Timex2SparqlConverterWSProvider
.
The Timex2SparqlConverter
has the following web
methods:
The convert
web method converts the temporal
information from a piece of text which is annotated in the extended TIMEX2
format to a SPARQL “FILTER” expression. Standard TIMEX2
annotations will result in a time point disjunction
SPARQL filter and two annotations with extended TIMEX2
annotations are considered to be start and end points of a time interval.
Sample request (SOAP body) for a simple standard TIMEX2 annotation:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <tim:ConversionRequest xmlns:tim="http://qallme.sf.net/wsdl/timex2sparqlconversion.wsdl" xmlns:tim1="http://qallme.sf.net/xsd/timex2.xsd"> <tim:TIMEX2AnnotatedText> <tim1:TIMEX2 VAL="2008-02-12T10:15">heute um 10:15 Uhr</tim1:TIMEX2> </tim:TIMEX2AnnotatedText> <tim:temporalContext>2008-02-12T12:56:23</tim:temporalContext> </tim:ConversionRequest> </soapenv:Body>
Sample request (SOAP body) for an extended TIMEX2 annotation:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <tim:ConversionRequest xmlns:tim="http://qallme.sf.net/wsdl/timex2sparqlconversion.wsdl"> <tim:TIMEX2AnnotatedText> <tim:TIMEX2 VAL="2008-02-12T14:00" function="FROM">heute von 14</tim:TIMEX2> <tim:TIMEX2 VAL="2008-02-12T18:30" function="TO">bis 18:30 Uhr</tim:TIMEX2> </tim:TIMEX2AnnotatedText> <tim:temporalContext>2008-02-12T12:56:23</tim:temporalContext> </tim:ConversionRequest> </soapenv:Body>
Sample response (SOAP body):
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <string xmlns="http://qallme.sf.net/wsdl/qallmeshared.wsdl" >FILTER (((xsd:dateTime("2008-02-12T13:45:00") <= xsd:dateTime(fn:string-join(fn:string-join(xsd:string(?date),"T"),xsd:string(?time)))) && (xsd:dateTime("2008-02-12T19:15:00") >= xsd:dateTime(fn:string-join(fn:string-join(xsd:string(?date),"T"),xsd:string(?time)))))).</string> </soapenv:Body>
?date
and ?time
. These variables
are therefore assumed to be existent in the SPARQL query in
which the filter will be used. Both ?date
and
?time
are restricted by the generated filter to temporal
expressions which are constrained by the input TIMEX2
annotation. Additionally, the namespace prefix “fn” must be defined in the
SPARQL query in which the filter is used: it has to be
defined as http://www.w3.org/2005/xpath-functions#
.
In the system-wide implementation of the Timex2SparqlConverter
for the QALL-ME Framework
the created SPARQL filter is usually a bit less strict than
the temporal expressions that it was created for, i.e., the times that the
created filters will match are the times given by the temporal expressions plus
a bit more. As the filters are intended for a QA system it is
usually a good idea to do this. For example, if someone asks “Which movies can I
see in Schmelz today at 8 p.m.?”, then he is probably also interested in the
movies at 20:25 or 19:50.