owlRequest
: this service answers to SPARQL requests to the Jena framework. The service returns the results as a formatted or XML contenthttp://dassault-aviation.com/jena:owlObjectRequest
: this service answers to SPARQL requests to the Jena framework and return the results as results as an objectowlRequest
service, the http://dassault-aviation.com/jena:owlObjectRequest
service return the results as a org.da.protoframework.jena.common.QueryResult
object. reqSchema
: the key of the OWL schema to use for the request, must correspond to the name
of one of the owlSchema
s in the propertiesquery
: the SPARQL query without the prefix. For example we could have:
SELECT ?pizza WHERE { ?pizza a owl:Class ; rdfs:subClassOf ?restriction. ?restriction owl:onProperty pizza:hasTopping ; owl:someValuesFrom pizza:PeperoniSausageTopping }
stripPrefix
: a boolean indicating if the prefix of the response results must be retained or stripped from the resultsorderedBy
: the name of the class used to order the resultsrespSchema
: the key of the OWL schema which was used for the requestresponse
: the response as a QueryResults
objectrequestStatus
: the status which can be NO_SCHEMA
if there was no OWL schema associated with the key, INVALID
, if the request was invalid, and VALID
if the request was validresponse
data is a QueryResults
object, which gives the list of results of the query. The API of this class is:public class org.da.protoframework.jena.common.QueryResults |
---|
Modifier and Type | Method and Description |
---|---|
int | countResults()
Return the number of results of the query
|
QueryResults.Result | getFirstResult()
Return the first result for the query
|
List<QueryResults.Result> | getOrderedResultsList()
Return the ordered list of results
|
Map<String, QueryResults.Result> | getResults()
Return all the results for the query. Note that it will return null if there are no results
|
boolean | hasResults()
Return true if there is at least one result for the query
|
SELECT
variable used to order the result (by the orderedBy
data). If this variable was not part of the SELECT
variables, then it will be the first encountered variable in the columns.
QueryResults.Result
contains the list of columns (ie corresponding to variables) for this result. This class has the following API:public class org.da.protoframework.jena.common.QueryResults.Result |
---|
Modifier and Type | Method and Description |
---|---|
int | countValues()
Return the number of values, which correspond to the nulber of variables declared in the
SELECT construct |
String | getKey()
Return the key of the result, corresponding to the variable returned in the result Map
|
Map<String, QueryResults.Value> | getResults()
Return all the values for the result, corresponding to the list of variables declared in the
SELECT construct. The key of the Map is the variable name |
QueryResults.Value | getValue(Strng key)
Return the value for a specified key (ie variable name)
|
Map<String, Value> | getValues()
Return ther first result for the query
|
QueryResults.Result
contains the value for one column (ie corresponding to a variable) for a result. This class has the following API: public class org.da.protoframework.jena.common.QueryResults.Value |
---|
Modifier and Type | Method and Description |
---|---|
Object | getValue()
Return the associated value
|
byte | getValueAsByte()
Return the associated value as a byte
|
char | getValueAsChar()
Return the associated value as a char
|
double | getValueAsDouble()
Return the associated value as a double
|
float | getValueAsFloat()
Return the associated value as a float
|
int | getValueAsInt()
Return the associated value as an int
|
long | getValueAsLong()
Return the associated value as a long
|
short | getValueAsShort()
Return the associated value as a short
|
String | getValueAsString()
Return the associated value as a String
|
SELECT ?number ?type WHERE { ?alarm rdf:type inav:Alarm . ?alarm inav:AlarmNumber ?number . ?alarm inav:hasAlarmType ?type . }The following code will print the
?number
and ?type
of each result:public void subscribe(ServiceInstance service) { QueryResults results = (QueryResults) service.getData("response").getValue(); Iterator<QueryResults.Result> it = results.getOrderedResultsList().iterator(); while (it.hasNext()) { QueryResults.Result result = it.next(); int number = result.getValue("number").getValueAsInt(); String type = result.getValue("type").getValueAsString(); System.out.println("Alarm " + number + ": " + type); } }
Copyright 2017-2020 Dassault Aviation. All Rights Reserved. Documentation and source under the LGPL v3 licence