Examples of ObjectSchema


Examples of jade.content.schema.ObjectSchema

 
  private List getOwnElementNames(Class c) {
    List names = new ArrayList();
    for (Enumeration e = elements.keys(); e.hasMoreElements();){
      String key  = (String)e.nextElement();
      ObjectSchema objSchema = (ObjectSchema) elements.get(key);
      if (c.isAssignableFrom(objSchema.getClass())) {
        names.add(objSchema.getTypeName());
      }
    }
    return names;
  }
View Full Code Here

Examples of jade.content.schema.ObjectSchema

   * @since JADE 3.7
   */
  public ConceptSlotFunction createConceptSlotFunction(String slotName, Concept c) throws OntologyException {
    // Scan the ontology hierarchy and get the ontology where concept c is defined.
    // Then create a ConceptSlotFunction refering to that ontology
    ObjectSchema schema = (ObjectSchema) schemas.get(c.getClass());
    if (schema != null) {
      if (conceptSlots != null) {
        if (schema.containsSlot(slotName)) {
          return new ConceptSlotFunction(slotName, c, this);
        }
        else {
          throw new OntologyException("Schema "+schema.getTypeName()+" for class "+c.getClass()+" does not contain a slot called "+slotName);
        }
      }
      else {
        throw new OntologyException("Ontology "+name+" does not support usage of concept slots as functions");
      }
View Full Code Here

Examples of jade.content.schema.ObjectSchema

   */
  protected void useConceptSlotsAsFunctions() {
    conceptSlots = new Hashtable();
    Enumeration en = schemas.elements();
    while (en.hasMoreElements()) {
      ObjectSchema schema = (ObjectSchema) en.nextElement();
      String[] slotNames = schema.getNames();
      for (int i = 0; i < slotNames.length; ++i) {
        System.out.println("Concept-slot-function: "+slotNames[i]);
        conceptSlots.put(slotNames[i], slotNames[i]);
      }
    }
View Full Code Here

Examples of jade.content.schema.ObjectSchema

  private void dump(List schemaNames, String label, StringBuilder sb) throws Exception {
 
    Iterator iter = schemaNames.iterator();
    String conceptName;
    ObjectSchema os;
    while (iter.hasNext()) {
      conceptName = (String)iter.next();
      os = getSchema(conceptName);
     
      StringBuilder sbsc = new StringBuilder();
      boolean first = true;
      ObjectSchema[] superSchemas = os.getSuperSchemas();
      for (int i = 0; i < superSchemas.length; i++) {
        if (!first) {
          sbsc.append(" ");
        }
        sbsc.append(superSchemas[i].getTypeName());
        first = false;
      }
     
      sb.append("  "+label+" "+conceptName+" ("+sbsc.toString()+") {\n");
      String[] names = os.getOwnNames();
      for (int i = 0; i < names.length; i++) {
        sb.append("    "+names[i]+": ");
        boolean mandatory = os.isMandatory(names[i]);
        ObjectSchema schema = os.getSchema(names[i]);
        if (schema == null) {
          sb.append("ERROR: no schema!\n");
        } else {
          Object defaultValue = null;
          Object regex = null;
          String pValues = null;
          Integer cardMin = null;
          Integer cardMax = null;
          Facet[] facets = os.getFacets(names[i]);
          if (facets != null) {
            for (int j = 0; j < facets.length; j++) {
              Facet facet = facets[j];
              if (facet instanceof DefaultValueFacet) {
                DefaultValueFacet dvf = (DefaultValueFacet)facet;
                defaultValue = dvf.getDefaultValue();
              } else if (facet instanceof RegexFacet) {
                RegexFacet rf = (RegexFacet)facet;
                regex = rf.getRegex();
              } else if (facet instanceof PermittedValuesFacet) {
                PermittedValuesFacet pvf = (PermittedValuesFacet)facet;
                pValues = pvf.getPermittedValuesAsString();
              } else if (facet instanceof CardinalityFacet) {
                CardinalityFacet cf = (CardinalityFacet)facet;
                cardMin = cf.getCardMin();
                cardMax = cf.getCardMax();
              }
            }
          }
         
          sb.append(schema.getTypeName()+ (!mandatory ? " (OPTIONAL)":""));
          if (defaultValue != null) {
            sb.append(" (DEFAULT="+defaultValue+")");
          }
          if (regex != null) {
            sb.append(" (REGEX="+regex+")");
View Full Code Here

Examples of jade.content.schema.ObjectSchema

    if (domainOnto != null) {
      // If an ontology is specified, get the slot names from it
      // (and not directly from the abstract descriptor val) to preserve
      // the order
      try {
        ObjectSchema s = domainOnto.getSchema(type);
        if (s == null) {
          throw new CodecException("No schema found for symbol "+type);
        }
        slotNames = s.getNames();
      }
      catch (OntologyException oe) {
        throw new CodecException("Error getting schema for symbol "+type, oe);
      }
    }
View Full Code Here

Examples of jade.content.schema.ObjectSchema

  private boolean getEncodingByOrder(AbsObject abs) throws CodecException {
    if (domainOnto != null) {
      String type = abs.getTypeName();
      try {
        ObjectSchema s = domainOnto.getSchema(type);
        return s.getEncodingByOrder();
      }
      catch (Exception e) {
        // Just ignore it
      }
    }
View Full Code Here

Examples of jade.content.schema.ObjectSchema

    }

    // If we get here it must be a complex OBJECT
    String typeName = readString(stream, type);
    // DEBUG System.out.println("Type is "+typeName);
    ObjectSchema schema = ontology.getSchema(typeName);
    // DEBUG System.out.println("Schema is "+schema);
    AbsObject    abs = schema.newInstance();

    byte marker = stream.readByte();

    do {
      if ((marker&UNMODIFIER) == ELEMENT) {
View Full Code Here

Examples of org.apache.drill.exec.schema.ObjectSchema

  }

  @Override
  public void setup(OutputMutator output) throws ExecutionSetupException {
    outputMutator = output;
    currentSchema = new ObjectSchema();
    diffSchema = new DiffSchema();
    removedFields = Lists.newArrayList();

    try {
      JsonFactory factory = new JsonFactory();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.