private CarOntology() {

    super(ONTOLOGY_NAME, BasicOntology.getInstance());

    try {

      add(new ConceptSchema(CAR), Car.class);
      add(new ConceptSchema(ENGINE), Engine.class);
      add(new PredicateSchema(AVAILABLE), Available.class);
      add(new ConceptSchema(COST), Cost.class);
      add(new ConceptSchema(AUTOMOBILE), AutoMobile.class);
      add(new ConceptSchema(CREDITCARD), CreditCard.class);
      add(new AgentActionSchema(RENT), Rent.class);
      add(new ConceptSchema(CATALOG), Catalog.class);

      ConceptSchema cs1 = (ConceptSchema) getSchema(CAR);
      cs1.add(BRAND, (PrimitiveSchema) getSchema(BasicOntology.STRING));
      cs1.add(MODEL, (PrimitiveSchema) getSchema(BasicOntology.STRING));
      cs1.add(COLOR, (PrimitiveSchema) getSchema(BasicOntology.STRING));
      cs1.add(YEAR, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));

      ConceptSchema cs2 = (ConceptSchema) getSchema(ENGINE);
      cs2.add(CAPACITY, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));
      cs2.add(HORSEPOWER, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));
      cs2.add(MILEAGE, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));

      ConceptSchema cs3 = (ConceptSchema) getSchema(COST);
      cs3.add(PRIZE, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));
      cs3.add(AUTOMOBILE, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));

      ConceptSchema cs4 = (ConceptSchema) getSchema(AUTOMOBILE);
      cs4.add(SERIALID, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));

      ConceptSchema cs5 = (ConceptSchema) getSchema(CREDITCARD);
      cs5.add(TYPE, (PrimitiveSchema) getSchema(BasicOntology.STRING));
      cs5.add(NUMBER, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));
      cs5.add(DATE, (PrimitiveSchema) getSchema(BasicOntology.DATE));

      ConceptSchema cs6 = (ConceptSchema) getSchema(CATALOG);
      cs6.add(CARS, (PrimitiveSchema) getSchema(AUTOMOBILE), 1, ObjectSchema.UNLIMITED);

      AgentActionSchema aas1 = (AgentActionSchema) getSchema(RENT);
      aas1.add(AID, (PrimitiveSchema) getSchema(BasicOntology.AID));
      aas1.add(AUTOMOBILE, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));
      aas1.add(CREDITCARD, (PrimitiveSchema) getSchema(BasicOntology.STRING));

      PredicateSchema ps1 = (PredicateSchema) getSchema(AVAILABLE);
      ps1.add(AID, (PrimitiveSchema) getSchema(BasicOntology.AID));
      ps1.add(AUTOMOBILE, (PrimitiveSchema) getSchema(BasicOntology.INTEGER));

    } catch (OntologyException oe) {

      oe.printStackTrace();
    }
  }
  public PeopleOntology(Ontology base) {
    super(ONTOLOGY_NAME, base, new ReflectiveIntrospector());

    try {
      PrimitiveSchema stringSchema = (PrimitiveSchema) getSchema(BasicOntology.STRING);
      PrimitiveSchema integerSchema = (PrimitiveSchema) getSchema(BasicOntology.INTEGER);

      ConceptSchema addressSchema = new ConceptSchema(ADDRESS);
      addressSchema.add(STREET, stringSchema, ObjectSchema.OPTIONAL);
      addressSchema.add(NUMBER, integerSchema, ObjectSchema.OPTIONAL);
      addressSchema.add(CITY, stringSchema);

      ConceptSchema personSchema = new ConceptSchema(PERSON);
      personSchema.add(NAME, stringSchema);
      personSchema.add(ADDRESS, addressSchema, ObjectSchema.OPTIONAL);

      ConceptSchema manSchema = new ConceptSchema(MAN);
      manSchema.addSuperSchema(personSchema);

      ConceptSchema womanSchema = new ConceptSchema(WOMAN);
      womanSchema.addSuperSchema(personSchema);

      add(personSchema, Person.class);
      add(manSchema, Man.class);
      add(womanSchema, Woman.class);
      add(addressSchema, Address.class);

      AggregateSchema childrenSchema = new AggregateSchema(BasicOntology.SEQUENCE);

      PredicateSchema fatherOfSchema = new PredicateSchema(FATHER_OF);
      fatherOfSchema.add(FATHER, manSchema);
      fatherOfSchema.add(CHILDREN, childrenSchema);

      PredicateSchema motherOfSchema = new PredicateSchema(MOTHER_OF);
      motherOfSchema.add(MOTHER, womanSchema);
      motherOfSchema.add(CHILDREN, childrenSchema);

      add(fatherOfSchema, FatherOf.class);
      add(motherOfSchema, MotherOf.class);

      AgentActionSchema marrySchema = new AgentActionSchema(MARRY);
      marrySchema.add(HUSBAND, manSchema);
      marrySchema.add(WIFE, womanSchema);

      add(marrySchema);
    } catch (OntologyException oe) {
      oe.printStackTrace();
    }
  }
Esempio n. 3
0
  public BookingOntology(Ontology base) {
    super(ONTOLOGY_NAME, base, new ReflectiveIntrospector());

    try {
      PrimitiveSchema stringSchema = (PrimitiveSchema) getSchema(BasicOntology.STRING);
      PrimitiveSchema dateSchema = (PrimitiveSchema) getSchema(BasicOntology.DATE);
      PrimitiveSchema intSchema = (PrimitiveSchema) getSchema(BasicOntology.INTEGER);
      // ContentElementListSchema listSchema =
      // (ContentElementListSchema)getSchema(BasicOntology.CONTENT_ELEMENT_LIST);

      // Definizione schema Centro Prenotazione
      ConceptSchema centroSchema = new ConceptSchema(CENTRO_PRENOTAZIONE);
      centroSchema.add(NOME, stringSchema, ObjectSchema.MANDATORY);
      centroSchema.add(TELEFONO, stringSchema, ObjectSchema.MANDATORY);
      centroSchema.add(VIA, stringSchema);
      centroSchema.add(PRESTAZIONI, stringSchema, 1, ObjectSchema.UNLIMITED);

      add(centroSchema, CentroPrenotazione.class);

      // Definizione schema Cliente
      ConceptSchema clienteSchema = new ConceptSchema(CLIENTE);
      clienteSchema.add(NOMEC, stringSchema, ObjectSchema.MANDATORY);
      clienteSchema.add(COGNOME, stringSchema, ObjectSchema.MANDATORY);
      clienteSchema.add(TELEFONOC, stringSchema, ObjectSchema.MANDATORY);

      add(clienteSchema, Cliente.class);

      ConceptSchema intervalliSchema = new ConceptSchema(INTERVALLOPRENOTAZIONE);
      intervalliSchema.add(INIZIOPRENOTAZIONE, dateSchema, ObjectSchema.MANDATORY);
      intervalliSchema.add(FINEPRENOTAZIONE, dateSchema, ObjectSchema.MANDATORY);

      add(intervalliSchema, IntervalloPrenotazione.class);

      // Definizione predicati
      PredicateSchema prenotazioneSchema = new PredicateSchema(PRENOTAZIONE);
      prenotazioneSchema.add(CLIENTE, clienteSchema, ObjectSchema.MANDATORY);
      prenotazioneSchema.add(PRESTAZIONE, stringSchema, ObjectSchema.MANDATORY);

      add(prenotazioneSchema, Prenotazione.class);

      PredicateSchema prenotazioneConDataSchema = new PredicateSchema(PRENOTAZIONE_CON_DATA);
      prenotazioneConDataSchema.add(CLIENTE, clienteSchema, ObjectSchema.MANDATORY);
      prenotazioneConDataSchema.add(PRESTAZIONE, stringSchema, ObjectSchema.MANDATORY);
      prenotazioneConDataSchema.add(DATAPRENOTAZIONE, dateSchema, ObjectSchema.OPTIONAL);

      add(prenotazioneConDataSchema, PrenotazioneConData.class);

      PredicateSchema confermaSchema = new PredicateSchema(CONFERMA);
      confermaSchema.add(CENTRO_PRENOTAZIONE, centroSchema, ObjectSchema.MANDATORY);
      confermaSchema.add(INIZIOPRENOTAZIONE, dateSchema, ObjectSchema.MANDATORY);
      confermaSchema.add(FINEPRENOTAZIONE, dateSchema, ObjectSchema.MANDATORY);
      confermaSchema.add(PRESTAZIONE, stringSchema, ObjectSchema.MANDATORY);
      confermaSchema.add(ID_PRENOTAZIONE, intSchema);

      add(confermaSchema, Conferma.class);

      PredicateSchema propostaSchema = new PredicateSchema(PROPOSTAINTERVALLI);
      propostaSchema.add(INTERVALLI, intervalliSchema, 1, ObjectSchema.UNLIMITED);
      propostaSchema.add(CENTRO_PRENOTAZIONE, centroSchema, ObjectSchema.MANDATORY);

      add(propostaSchema, PropostaIntervalli.class);

    } catch (OntologyException oe) {
      oe.printStackTrace();
    }
  }