public class Request extends ServiceRequest
Request req=new Request(new Lighting(null));
req.put(new String[]{Lighting.PROP_CONTROLS,LightSource.PROP_HAS_TYPE}, new Typematch(ElectricLight.MY_URI));
req.put(new String[]{Lighting.PROP_CONTROLS}, new Variable(new LightSource(desiredURI)));
req.put(new String[]{Lighting.PROP_CONTROLS,LightSource.PROP_SOURCE_BRIGHTNESS }, new Change(new Integer(0)));
caller.call(req);
This is not necessarily faster nor better than the usual way of doing it with
ServiceRequest. It's just an alternative way that might help those less
familiarized with universAAL.Modifier and Type | Field and Description |
---|---|
static String |
MY_NAMESPACE
Default namespace.
|
MY_URI, PROP_AGGREGATING_FILTER, PROP_REQUESTED_SERVICE, PROP_REQUIRED_PROCESS_RESULT, PROP_SERVICE_CALLER
ONLY_LOCAL_SCOPE, PROP_ORIG_SCOPE, PROP_SCOPES
ANON_URI_PREFIX, blockAddingTypes, isXMLLiteral, NAMESPACE_PREFIX, ns_delim_index, PROP_INVOLVED_HUMAN_USER, PROP_RDF_FIRST, PROP_RDF_REST, PROP_RDF_TYPE, PROP_RDFS_COMMENT, PROP_RDFS_LABEL, PROP_SERIALIZATION_FULL, PROP_SERIALIZATION_OPTIONAL, PROP_SERIALIZATION_REDUCED, PROP_SERIALIZATION_UNDEFINED, props, RDF_EMPTY_LIST, RDF_NAMESPACE, RDFS_NAMESPACE, SERVICE_NAMESPACE, TYPE_RDF_LIST, TYPE_RDFS_CLASS, uri, VOCABULARY_NAMESPACE
Constructor and Description |
---|
Request(Service requestedServiceRoot)
Use this helper class to create a ServiceRequest that is easy to use.
|
Modifier and Type | Method and Description |
---|---|
protected Hashtable |
getInput()
I have to put this because of all service refactoring stuff.
|
void |
put(Path branch,
Add leaf)
Equivalent to put(String[] branch, Add leaf).
|
void |
put(Path branch,
Change leaf)
Equivalent to put(String[] branch, Change leaf).
|
void |
put(Path branch,
Output leaf)
Equivalent to put(String[] branch, Output leaf).
|
void |
put(Path branch,
Remove leaf)
Equivalent to put(String[] branch, Remove leaf).
|
void |
put(Path branch,
Typematch leaf)
Equivalent to put(String[] branch, Typematch leaf).
|
void |
put(Path branch,
Variable leaf)
Equivalent to put(Path branch, Variable leaf).
|
void |
put(String[] branch,
Add leaf)
Use this helper method to declare an argument over a Request, specifying
that you want to add, in the given branch of properties, the
value instance expressed with Add argument.
|
void |
put(String[] branch,
Change leaf)
Use this helper method to declare an argument over a Request, specifying
that you want to change, at the given branch of properties, an old
value with a new one, an instance expressed with Change argument.
|
void |
put(String[] branch,
Output leaf)
Use this helper method to declare an argument over a Request, specifying
that you want the kind of output specified by the given branch of
properties, and you want it to be put in the ServiceResponse under the
ID specified with the Output argument.
|
void |
put(String[] branch,
Remove leaf)
Use this helper method to declare an argument over a Request, specifying
that you want to remove, from the given branch of properties,
the value instance expressed with Remove argument.
|
void |
put(String[] branch,
Typematch leaf)
Use this helper method to declare an argument over a Request, specifying
that the requested service must have, in the given branch of properties,
an instance of the same type expressed with Typematch argument.
|
void |
put(String[] branch,
Variable leaf)
Use this helper method to declare an argument over a Request, specifying
that the requested service will receive as variable input, in the
given branch of properties, the instance expressed with Variable
argument.
|
static Object[] |
recoverOutputs(ServiceResponse sr,
Output output)
Equivalent to recoverOutputs(ServiceResponse sr, String outputURI).
|
static Object[] |
recoverOutputs(ServiceResponse sr,
String outputURI)
Use this helper method when you have called a ServiceRequest (or a
Request) and you want to get an array containing all the outputs
returned.
|
acceptsRandomSelection, addAddEffect, addAggregatingFilter, addAggregatingOutputBinding, addChangeEffect, addRemoveEffect, addRequiredOutput, addSimpleOutputBinding, addTypeFilter, addValueFilter, getFilters, getOutputAggregations, getPropSerializationType, getRequestedService, getRequiredEffects, getRequiredOutputs, isWellFormed, matches, setProperty
addScope, clearScopes, getOriginScope, getScopes, isScoped, isSerializableTo, setOriginScope, setScope
addType, getLocalName, getNamespace, getProperty, getPropertyURIs, getType, getTypes, getURI, hasQualifiedName, isAnon, numberOfProperties
addMultiLangProp, asList, asList, asRDFList, changeProperty, copy, deepCopy, equals, generateAnonURI, getDefaultLang, getFilename, getMultiLangProp, getOrConstructLabel, getOrConstructLabel, getResource, getResourceComment, getResourceLabel, getResourceLabel, getStaticFieldValue, hashCode, hasProperty, isAnon, isBlockingAddingTypes, isClosedCollection, isQualifiedName, literal, representsQualifiedURI, serializesAsXMLLiteral, setPropertyPath, setPropertyPath, setPropertyPathFromOffset, setResourceComment, setResourceLabel, toString, toStringRecursive, toStringRecursive, unliteral
public static final String MY_NAMESPACE
public Request(Service requestedServiceRoot)
Request req=new Request(new Lighting(null));
requestedServiceRoot
- An instance of the Service class that you want to call,
created with null URI.public void put(String[] branch, Typematch leaf)
req.put(new String[]{Lighting.PROP_CONTROLS,LightSource.PROP_HAS_TYPE}, new Typematch(ElectricLight.MY_URI));
branch
- The path of properties from the Service root class to the
value to be restrictedleaf
- The Typematch describing the type of instance expected at the
end of the branchpublic void put(Path branch, Typematch leaf)
branch
- The path of properties from the Service root class to the
value to be restrictedleaf
- The Typematch describing the type of instance expected at the
end of the branchpublic void put(String[] branch, Variable leaf)
req.put(new String[]{Lighting.PROP_CONTROLS}, new Variable(new LightSource(exactURI)));
branch
- The path of properties from the Service root class to the
value to be received as input by the serviceleaf
- The Variable describing the value that you want to pass as
variable input to the servicepublic void put(Path branch, Variable leaf)
branch
- The path of properties from the Service root class to the
value to be received as input by the serviceleaf
- The Variable describing the value that you want to pass as
variable input to the servicepublic void put(String[] branch, Output leaf)
req.put(new String[]{Lighting.PROP_CONTROLS}, new Output("http://ontology.igd.fhg.de/LightingConsumer.owl#listOfLamps"));
branch
- The path of properties from the Service root class to the
output that you wantleaf
- The Output describing the URI (the ID) that you will use when
dealing with the ServiceResponsepublic void put(Path branch, Output leaf)
branch
- The path of properties from the Service root class to the
output that you wantleaf
- The Output describing the URI (the ID) that you will use when
dealing with the ServiceResponsepublic void put(String[] branch, Add leaf)
req.put(new String[]{Lighting.PROP_CONTROLS}, new Add(new LightSource(addURI)));
branch
- The path of properties from the Service root class to the
value to be addedleaf
- The Add describing the instance to be added at the end of the
branchpublic void put(Path branch, Add leaf)
branch
- The path of properties from the Service root class to the
value to be addedleaf
- The Add describing the instance to be added at the end of the
branchpublic void put(String[] branch, Remove leaf)
req.put(new String[]{Lighting.PROP_CONTROLS}, new Remove(new LightSource(quitURI)));
branch
- The path of properties from the Service root class to the
value to be removedleaf
- The Remove describing the instance to be removed at the end of
the branchpublic void put(Path branch, Remove leaf)
branch
- The path of properties from the Service root class to the
value to be removedleaf
- The Remove describing the instance to be removed at the end of
the branchpublic void put(String[] branch, Change leaf)
req.put(new String[]{Lighting.PROP_CONTROLS,LightSource.PROP_SOURCE_BRIGHTNESS }, new Change(new Integer(0)));
branch
- The path of properties from the Service root class to the
value to be changedleaf
- The Change describing the new instance to be put at the end of
the branchpublic void put(Path branch, Change leaf)
branch
- The path of properties from the Service root class to the
value to be changedleaf
- The Change describing the new instance to be put at the end of
the branchpublic static Object[] recoverOutputs(ServiceResponse sr, Output output)
sr
- The ServiceResponse returned by the .call methodoutput
- The Output you used when building the requestnull
in all other
cases (Service errors, no outputs,...)public static Object[] recoverOutputs(ServiceResponse sr, String outputURI)
sr
- The ServiceResponse returned by the .call methodoutputURI
- The URI (the ID) you used to refer to the output when building
the requestnull
in all other
cases (Service errors, no outputs,...)protected Hashtable getInput()
Copyright © 2018 universAAL Consortium. All rights reserved.