org.universAAL.support.utils.service.mid
Class UtilEditor

Package class diagram package UtilEditor
java.lang.Object
  extended by org.universAAL.support.utils.service.mid.UtilEditor

public class UtilEditor
extends Object

This is a helper class for those who want to use the typical services of an editor (get, add, change and remove) over an ontological service. It provides methods for automatically generating service profiles and service requests that can be used in ServiceCallees and ServiceCallers. If they are both with he same parameters in both sides, the services are guaranteed to match.

Author:
alfiva

Field Summary
static String FAKE_URI
          Argument suffix.
static String IN_ADD
          Argument suffix.
static String IN_CHANGE
          Argument suffix.
static String IN_GET
          Argument suffix.
static String IN_REMOVE
          Argument suffix.
static String OUT_GET
          Argument suffix.
static String SERVICE_ADD
          Service suffix.
static String SERVICE_CHANGE
          Service suffix.
static String SERVICE_GET
          Service suffix.
static String SERVICE_REMOVE
          Service suffix.
 
Constructor Summary
UtilEditor()
           
 
Method Summary
static ServiceProfile[] getServiceProfiles(String namespace, String ontologyURI, String[] path, String editedURI)
          Gives you the 4 typical service profiles of an editor service: Get, Add, Change and Remove.
static ServiceRequest requestAdd(String ontologyURI, String[] path, Add argAdd)
          Gives you the typical ADD service request for editor services.
static ServiceRequest requestAdd(String ontologyURI, String[] path, Object add)
          Gives you the typical ADD service request for editor services.
static ServiceRequest requestChange(String ontologyURI, String[] path, Change argChange)
          Gives you the typical CHANGE service request for editor services.
static ServiceRequest requestChange(String ontologyURI, String[] path, Object change)
          Gives you the typical CHANGE service request for editor services.
static ServiceRequest requestGet(String ontologyURI, String[] path, Object in, String out)
          Gives you the typical GET service request for editor services.
static ServiceRequest requestGet(String ontologyURI, String[] path, Variable argIn, Output argOut)
          Gives you the typical GET service request for editor services.
static ServiceRequest requestRemove(String ontologyURI, String[] path, Object remove)
          Gives you the typical REMOVE service request for editor services.
static ServiceRequest requestRemove(String ontologyURI, String[] path, Remove argRemove)
          Gives you the typical REMOVE service request for editor services.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SERVICE_GET

public static final String SERVICE_GET
Service suffix.

See Also:
Constant Field Values

SERVICE_ADD

public static final String SERVICE_ADD
Service suffix.

See Also:
Constant Field Values

SERVICE_CHANGE

public static final String SERVICE_CHANGE
Service suffix.

See Also:
Constant Field Values

SERVICE_REMOVE

public static final String SERVICE_REMOVE
Service suffix.

See Also:
Constant Field Values

FAKE_URI

public static final String FAKE_URI
Argument suffix.

See Also:
Constant Field Values

IN_GET

public static final String IN_GET
Argument suffix.

See Also:
Constant Field Values

OUT_GET

public static final String OUT_GET
Argument suffix.

See Also:
Constant Field Values

IN_ADD

public static final String IN_ADD
Argument suffix.

See Also:
Constant Field Values

IN_CHANGE

public static final String IN_CHANGE
Argument suffix.

See Also:
Constant Field Values

IN_REMOVE

public static final String IN_REMOVE
Argument suffix.

See Also:
Constant Field Values
Constructor Detail

UtilEditor

public UtilEditor()
Method Detail

getServiceProfiles

public static ServiceProfile[] getServiceProfiles(String namespace,
                                                  String ontologyURI,
                                                  String[] path,
                                                  String editedURI)
Gives you the 4 typical service profiles of an editor service: Get, Add, Change and Remove. When handling requests in you Callee, you can use the references to services and arguments URIs prepending namespace to UtilEditor constants.

Example:

new SCallee(context, getServiceProfiles("http://ontology.universAAL.org/ProfilingServer.owl#", ProfilingService.MY_URI, Path.start(ProfilingService.PROP_CONTROLS).path, Profilable.MY_URI))

Parameters:
namespace - The namespace of your server, ending with the character #. You can optionally add some prefix after the # if you use UtilEditor more than once in the same Callee.
ontologyURI - The MY_URI of the class of Service ontology you are going to implement
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
editedURI - The MY_URI of the class of the concept ontology that you want to manage, which is at the end of the property path
Returns:
An array with the 4 typical service profiles

requestGet

public static ServiceRequest requestGet(String ontologyURI,
                                        String[] path,
                                        Variable argIn,
                                        Output argOut)
Gives you the typical GET service request for editor services. If the editor service also used UtilEditor the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
argIn - Value representing the input you want to pass as parameter. The editor GET service will return you the full Resource with the URI of this argument.
argOut - The returned value of the editor GET service will be placed in the URI represented by this Output. Look for it there in the response.
Returns:
The ServiceRequest that will call the matching GET service of an editor

requestGet

public static ServiceRequest requestGet(String ontologyURI,
                                        String[] path,
                                        Object in,
                                        String out)
Gives you the typical GET service request for editor services. If the editor service also used UtilEditor the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
in - Object representing the input you want to pass as parameter. The editor GET service will return you the full Resource with the URI of this argument.
out - The returned value of the editor GET service will be placed in this URI. Look for it there in the response.
Returns:
The ServiceRequest that will call the matching GET service of an editor

requestAdd

public static ServiceRequest requestAdd(String ontologyURI,
                                        String[] path,
                                        Add argAdd)
Gives you the typical ADD service request for editor services. If the editor service also used UtilEditor the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
argAdd - Add representing the input you want to pass as parameter. The editor ADD service will add the full Resource passed in this argument.
Returns:
The ServiceRequest that will call the matching ADD service of an editor

requestAdd

public static ServiceRequest requestAdd(String ontologyURI,
                                        String[] path,
                                        Object add)
Gives you the typical ADD service request for editor services. If the editor service also used UtilEditor the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
add - Object representing the input you want to pass as parameter. The editor ADD service will add the full Resource passed in this argument.
Returns:
The ServiceRequest that will call the matching ADD service of an editor

requestChange

public static ServiceRequest requestChange(String ontologyURI,
                                           String[] path,
                                           Change argChange)
Gives you the typical CHANGE service request for editor services. If the editor service also used UtilEditor the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
argChange - Change representing the input you want to pass as parameter. The editor CHANGE service will replace the Resource of the same URI with this new value
Returns:
The ServiceRequest that will call the matching CHANGE service of an editor

requestChange

public static ServiceRequest requestChange(String ontologyURI,
                                           String[] path,
                                           Object change)
Gives you the typical CHANGE service request for editor services. If the editor service also used UtilEditor the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
change - Object representing the input you want to pass as parameter. The editor CHANGE service will replace the Resource of the same URI with this new value
Returns:
The ServiceRequest that will call the matching CHANGE service of an editor

requestRemove

public static ServiceRequest requestRemove(String ontologyURI,
                                           String[] path,
                                           Remove argRemove)
Gives you the typical REMOVE service request for editor services. If the editor service also used UtilEditor the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
argRemove - Object representing the input you want to pass as parameter. The editor REMOVE service will remove all occurences of the Resource of the same URI of this argument
Returns:
The ServiceRequest that will call the matching CHANGE service of an editor

requestRemove

public static ServiceRequest requestRemove(String ontologyURI,
                                           String[] path,
                                           Object remove)
Gives you the typical REMOVE service request for editor services. If the editor service also used UtilEditor the match is guaranteed.

Parameters:
ontologyURI - The MY_URI of the class of Service ontology you want to call
path - The property path from the root of the Service ontology concept to the exact concept you want to manage
remove - Object representing the input you want to pass as parameter. The editor REMOVE service will remove all occurences of the Resource of the same URI of this object
Returns:
The ServiceRequest that will call the matching CHANGE service of an editor


Copyright © 2014 universAAL Consortium. All Rights Reserved.