Package jade.content.abs
Class AbsHelper
- java.lang.Object
-
- jade.content.abs.AbsHelper
-
public class AbsHelper extends Object
- Author:
- Federico Bergenti - Universita` di Parma, Giovanni Caire - TILAB
-
-
Constructor Summary
Constructors Constructor Description AbsHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static AbsObjectaddPrefix(AbsObject abs, String prefix)Recursively add prefix to abs-type-name, except for BasicOntology types Eg.static AbsObjectapplyDefaultValues(AbsObject absTemplate, AbsObject absDefault)Apply default value to template Replace node with default value only if the value in template is null or AbsVariable or default value is null and template is a true templatestatic AbsObjectcreateAbsTemplate(ObjectSchema schema)Generate an AbsObject consistently with schema.static AbsObjectcreateAbsTemplate(ObjectSchema schema, String prefix)Generate an AbsObject consistently with schema.static AbsObjectcreateAbsTemplate(Class clazz, Ontology onto)Generate an AbsObject consistently with class.static AbsAgentActionexternaliseACLMessage(ACLMessage obj, Ontology onto)Converts anACLMessageinto anAbsAgentActionusing the specified ontology.static AbsConceptexternaliseAID(AID obj)Converts anAIDinto anAbsConceptrepresenting an AIDstatic AbsContentElementListexternaliseContentElementList(ContentElementList obj, Ontology onto)Converts aContentElementListinto anAbsContentElementListusing the specified ontology.static AbsAggregateexternaliseIterator(Iterator obj, Ontology onto, String AggregateType)Converts anIteratorinto aAbsAggregateusing the specified ontology.static AbsAggregateexternaliseList(List obj, Ontology onto, String AggregateType)Converts aListinto aAbsAggregateusing the specified ontology.static AbsConceptexternaliseProperty(Property obj, Ontology onto)Converts aPROPERTYinto anAbsConceptrepresenting a PROPERTYstatic AbsAggregateexternaliseSet(Set obj, Ontology onto, String AggregateType)Converts aSetinto aAbsAggregateusing the specified ontology.static OntoACLMessageinternaliseACLMessage(AbsAgentAction absMsg, Ontology onto)Converts to anAbsAgentActionrepresenting an ACLMessage into an OntoACLMessage using the specified ontology.static OntoAIDinternaliseAID(AbsConcept aid)Converts anAbsConceptrepresenting an AID into an OntoAIDstatic ContentElementListinternaliseContentElementList(AbsContentElementList l, Ontology onto)Converts to anAbsContentElementListinto a ContentElementList using the specified ontology.static CollectioninternaliseJavaCollection(AbsAggregate aggregate, Ontology onto)Converts anAbsAggregateinto a List using the specified ontology.static ListinternaliseList(AbsAggregate aggregate, Ontology onto)Converts anAbsAggregateinto a List using the specified ontology.static PropertyinternaliseProperty(AbsConcept property, Ontology onto)Converts anAbsConceptrepresenting a PROPERTY into an Propertystatic SetinternaliseSet(AbsAggregate aggregate, Ontology onto)Converts anAbsAggregateinto a Set using the specified ontology.static booleanisAbsTemplate(AbsObject abs)Return true if the abs-object is a template.static AbsObjectnullifyVariables(AbsObject abs, boolean removeEmptyAggregate)Remove all variables and empty aggregates (only if specified)static AbsObjectremovePrefix(AbsObject abs, String separator)Recursively removes prefix (if present) from abs-type-name, except for BasicOntology types Prefix is identified from last separator string Eg.static voidsetAttribute(AbsObject abs, String attrName, AbsObject attrValue)Set an attribute in an abstract descriptor performing all necessary type checks.
-
-
-
Method Detail
-
externaliseList
public static AbsAggregate externaliseList(List obj, Ontology onto, String AggregateType) throws OntologyException
Converts aListinto aAbsAggregateusing the specified ontology.- Parameters:
obj- theListonto- the ontology.- Returns:
- the abstract descriptor.
- Throws:
OntologyException
-
externaliseSet
public static AbsAggregate externaliseSet(Set obj, Ontology onto, String AggregateType) throws OntologyException
Converts aSetinto aAbsAggregateusing the specified ontology.- Parameters:
obj- theSetonto- the ontology.- Returns:
- the abstract descriptor.
- Throws:
OntologyException
-
externaliseIterator
public static AbsAggregate externaliseIterator(Iterator obj, Ontology onto, String AggregateType) throws OntologyException
Converts anIteratorinto aAbsAggregateusing the specified ontology.- Parameters:
obj- theIteratoronto- the ontology.- Returns:
- the abstract descriptor.
- Throws:
OntologyException
-
externaliseAID
public static AbsConcept externaliseAID(AID obj)
Converts anAIDinto anAbsConceptrepresenting an AID- Parameters:
obj- theAID- Returns:
- the abstract descriptor.
-
externaliseProperty
public static AbsConcept externaliseProperty(Property obj, Ontology onto) throws OntologyException
Converts aPROPERTYinto anAbsConceptrepresenting a PROPERTY- Parameters:
obj- thePROPERTY- Returns:
- the abstract descriptor.
- Throws:
OntologyException
-
externaliseContentElementList
public static AbsContentElementList externaliseContentElementList(ContentElementList obj, Ontology onto) throws OntologyException
Converts aContentElementListinto anAbsContentElementListusing the specified ontology.- Parameters:
obj- theContentElementListonto- the ontology.- Returns:
- the abstract descriptor.
- Throws:
OntologyException
-
externaliseACLMessage
public static AbsAgentAction externaliseACLMessage(ACLMessage obj, Ontology onto) throws OntologyException
Converts anACLMessageinto anAbsAgentActionusing the specified ontology.- Parameters:
obj- theACLMessageonto- the ontology.- Returns:
- the abstract descriptor.
- Throws:
OntologyException
-
internaliseList
public static List internaliseList(AbsAggregate aggregate, Ontology onto) throws OntologyException
Converts anAbsAggregateinto a List using the specified ontology.- Parameters:
onto- the ontology- Returns:
- the List
- Throws:
OntologyException
-
internaliseSet
public static Set internaliseSet(AbsAggregate aggregate, Ontology onto) throws OntologyException
Converts anAbsAggregateinto a Set using the specified ontology.- Parameters:
onto- the ontology- Returns:
- the Set
- Throws:
OntologyException
-
internaliseJavaCollection
public static Collection internaliseJavaCollection(AbsAggregate aggregate, Ontology onto) throws OntologyException
Converts anAbsAggregateinto a List using the specified ontology.- Parameters:
onto- the ontology- Returns:
- the List
- Throws:
OntologyException
-
internaliseAID
public static OntoAID internaliseAID(AbsConcept aid) throws OntologyException
Converts anAbsConceptrepresenting an AID into an OntoAID- Returns:
- the OntoAID
- Throws:
OntologyException- ifaiddoes not represent a valid AID
-
internaliseProperty
public static Property internaliseProperty(AbsConcept property, Ontology onto) throws OntologyException
Converts anAbsConceptrepresenting a PROPERTY into an Property- Returns:
- the Property
- Throws:
OntologyException- ifpropertydoes not represent a valid PROPERTY
-
internaliseContentElementList
public static ContentElementList internaliseContentElementList(AbsContentElementList l, Ontology onto) throws OntologyException
Converts to anAbsContentElementListinto a ContentElementList using the specified ontology.- Parameters:
onto- the ontology- Returns:
- the ContentElementList
- Throws:
OntologyException
-
internaliseACLMessage
public static OntoACLMessage internaliseACLMessage(AbsAgentAction absMsg, Ontology onto) throws OntologyException
Converts to anAbsAgentActionrepresenting an ACLMessage into an OntoACLMessage using the specified ontology.- Parameters:
onto- the ontology- Returns:
- the OntoACLMessage
- Throws:
OntologyException
-
setAttribute
public static void setAttribute(AbsObject abs, String attrName, AbsObject attrValue) throws OntologyException
Set an attribute in an abstract descriptor performing all necessary type checks.- Throws:
OntologyException- if a type mismatch is detected
-
nullifyVariables
public static AbsObject nullifyVariables(AbsObject abs, boolean removeEmptyAggregate)
Remove all variables and empty aggregates (only if specified)- Parameters:
abs- to nullifyremoveEmptyAggregate- if true remove all empty aggregates- Returns:
- abs without variables and empty aggregates
-
removePrefix
public static AbsObject removePrefix(AbsObject abs, String separator) throws OntologyException
Recursively removes prefix (if present) from abs-type-name, except for BasicOntology types Prefix is identified from last separator string Eg. A.B.C -> C (if separator is .)- Parameters:
abs- abs to un-prefixseparator- separator string- Returns:
- un-prefixde abs
- Throws:
OntologyException
-
addPrefix
public static AbsObject addPrefix(AbsObject abs, String prefix) throws OntologyException
Recursively add prefix to abs-type-name, except for BasicOntology types Eg. C -> A.B.C (if prefix is A.B.)- Parameters:
abs- abs to prefixprefix- prefix to add- Returns:
- prefix abs
- Throws:
OntologyException
-
isAbsTemplate
public static boolean isAbsTemplate(AbsObject abs)
Return true if the abs-object is a template. A template is an abs with all slots AbsVariable or AbsAggregate empty- Parameters:
abs- abs-object to check- Returns:
- true if is a template
-
applyDefaultValues
public static AbsObject applyDefaultValues(AbsObject absTemplate, AbsObject absDefault) throws OntologyException
Apply default value to template Replace node with default value only if the value in template is null or AbsVariable or default value is null and template is a true template- Parameters:
absTemplate- abs template valueabsDefault- abs value with default value- Returns:
- Throws:
OntologyException
-
createAbsTemplate
public static AbsObject createAbsTemplate(Class clazz, Ontology onto) throws OntologyException
Generate an AbsObject consistently with class.- Parameters:
clazz- class to convertonto- reference ontology- Returns:
- abs-object
- Throws:
OntologyException
-
createAbsTemplate
public static AbsObject createAbsTemplate(ObjectSchema schema) throws OntologyException
Generate an AbsObject consistently with schema.- Parameters:
schema- to convert- Returns:
- abs-object
- Throws:
ExceptionOntologyException
-
createAbsTemplate
public static AbsObject createAbsTemplate(ObjectSchema schema, String prefix) throws OntologyException
Generate an AbsObject consistently with schema. All variables are prefixed- Parameters:
schema- to convertprefix- for variable- Returns:
- abs-object
- Throws:
ExceptionOntologyException
-
-