Package jade.content.schema

Examples of jade.content.schema.TermSchema


 
  private void manageActionResult(Class clazz, ObjectSchema schema, boolean buildHierarchy) throws OntologyException {
    Annotation annotation;
    if ((annotation = clazz.getAnnotation(Result.class)) != null) {
      Result r = (Result)annotation;
      TermSchema ts = (TermSchema)doAddSchema(r.type(), buildHierarchy);
      ((AgentActionSchema)schema).setResult(ts);
    } else if ((annotation = clazz.getAnnotation(AggregateResult.class)) != null) {
      AggregateResult ar = (AggregateResult)annotation;
      TermSchema ts = (TermSchema)doAddSchema(ar.type(), buildHierarchy);
      ((AgentActionSchema)schema).setResult(ts, ar.cardMin(), ar.cardMax());
    }

  }
View Full Code Here


    if (logger.isLoggable(Logger.FINE)) {
      logger.log(Logger.FINE, "concept "+schema.getTypeName()+": adding slot "+slotName);
    }
   
    if (!sad.aggregate) {
      TermSchema ts = (TermSchema)doAddSchema(sad.type, buildHierarchy, sad.manageAsSerializable);
      schema.add(slotName, ts, sad.mandatory ? ObjectSchema.MANDATORY : ObjectSchema.OPTIONAL);
     
      if (sad.defaultValue != null) {
        schema.addFacet(slotName, new DefaultValueFacet(sad.defaultValue));
      }
      if (sad.regex != null) {
        schema.addFacet(slotName, new RegexFacet(sad.regex));
      }
      if (sad.documentation != null) {
        schema.addFacet(slotName, new DocumentationFacet(sad.documentation));
      }
      if (sad.permittedValues != null) {
        // Adjust permitted values in correct class type
        // This is necessary because in the annotation the permitted values are string
        Object[] typizedPermittedValues = new Object[sad.permittedValues.length];
        if (sad.type != null) {
          for(int i=0; i<sad.permittedValues.length; i++) {
            typizedPermittedValues[i] = BasicOntology.adjustPrimitiveValue(sad.permittedValues[i], sad.type);
          }
        }
        schema.addFacet(slotName, new PermittedValuesFacet(typizedPermittedValues));
      }
      if ("true".equalsIgnoreCase(System.getProperty(SLCodec.PRESERVE_JAVA_TYPES)) &&
        sad.type == Long.class ||
          sad.type == long.class ||
          sad.type == Double.class ||
          sad.type == double.class)) {
        schema.addFacet(slotName, new JavaTypeFacet(sad.type.getName()));
      }
    } else {
      TermSchema ats = null;
      if (sad.aggregateClass != null) {
        // try to get a schema for the contained type
        ats = (TermSchema)doAddSchema(sad.aggregateClass, buildHierarchy, sad.manageAsSerializable);
      }
      schema.add(slotName, ats, sad.cardMin, sad.cardMax, getAggregateSchemaName(sad.type), sad.mandatory?ObjectSchema.MANDATORY:ObjectSchema.OPTIONAL);
View Full Code Here

          }
        }
        schema.addFacet(slotName, new PermittedValuesFacet(typizedPermittedValues));
      }
    } else {
      TermSchema ats = null;
      if (sad.aggregateClass != null) {
        // try to get a schema for the contained type
        ats = (TermSchema)doAddSchema(sad.aggregateClass, buildHierarchy, sad.manageAsSerializable);
      }
      schema.add(slotName, ats, sad.cardMin, sad.cardMax, getAggregateSchemaName(sad.type), sad.mandatory?ObjectSchema.MANDATORY:ObjectSchema.OPTIONAL);
View Full Code Here

TOP

Related Classes of jade.content.schema.TermSchema

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.