コード例 #1
0
 public void visit(OWLUntypedConstant node) {
   try {
     lastDataValuePointer = owlConstant2DataValuePointerMap.get(node);
     if (lastDataValuePointer == null) {
       owlOntologyManager
           .getOWLDataFactory()
           .getOWLDataType(XSDVocabulary.STRING.getURI())
           .accept((OWLDataVisitor) this);
       lastDataValuePointer =
           faCTPlusPlus.getDataValue(node.getLiteral(), getLastDataTypePointer());
       owlConstant2DataValuePointerMap.put(node, lastDataValuePointer);
       dataValuePointerMap.put(lastDataValuePointer, node);
     }
   } catch (Exception e) {
     throw new FaCTPlusPlusRuntimeException(e);
   }
 }
コード例 #2
0
  private void initializeThinklabTypes() throws ThinklabValidationException {

    Properties p = LocalConfiguration.getProperties();

    // TODO all this stuff should be left to a specified plugin if installed, and done this way
    // only as a last resort. Also plugin properties should be used.
    /* store references to commonly used concepts. These come from system config, defaulted to core IMA ontology. */
    try {
      integerTypeID =
          new SemanticType(p.getProperty("type.class.integer", "thinklab-core:Integer"));
      floatTypeID =
          new SemanticType(p.getProperty("type.class.float", "thinklab-core:FloatingPoint"));
      longTypeID = new SemanticType(p.getProperty("type.class.long", "thinklab-core:LongInteger"));
      doubleTypeID =
          new SemanticType(p.getProperty("type.class.double", "thinklab-core:LongFloatingPoint"));
      numberTypeID = new SemanticType(p.getProperty("type.class.number", "thinklab-core:Number"));
      booleanTypeID =
          new SemanticType(p.getProperty("type.class.boolean", "thinklab-core:Boolean"));
      literalTypeID =
          new SemanticType(p.getProperty("type.class.literal", "thinklab-core:LiteralValued"));
      textTypeID = new SemanticType(p.getProperty("type.class.text", "thinklab-core:Text"));
      operatorTypeID =
          new SemanticType(p.getProperty("type.class.operator", "thinklab-core:Operation"));
      rootTypeID = new SemanticType(p.getProperty("type.class.thing", "owl:Thing"));
      ordinalRankingTypeID =
          new SemanticType(
              p.getProperty("type.class.ordinal-ranking", "thinklab-core:OrdinalRanking"));
      booleanRankingTypeID =
          new SemanticType(
              p.getProperty("type.class.boolean-ranking", "thinklab-core:BooleanRanking"));
      ordinalRangeMappingTypeID =
          new SemanticType(
              p.getProperty(
                  "type.class.ordered-range-mapping", "thinklab-core:OrderedRangeMapping"));

      reifiedLiteralPropertyID =
          new SemanticType(
              p.getProperty(
                  "type.property.reified-literal", "thinklab-core:ExtendedLiteralProperty"));

      classificationPropertyID =
          new SemanticType(
              p.getProperty(
                  "type.property.classification", "thinklab-core:ClassificationProperty"));

      additionalRestrictionsPropertyID =
          new SemanticType(
              p.getProperty("type.property.restrictions", "thinklab-core:AdditionalRestrictions"));

      abstractPropertyID =
          new SemanticType(p.getProperty("type.property.abstract", "thinklab-core:AbstractClass"));

      importedPropertyID =
          new SemanticType(p.getProperty("type.property.imported", "thinklab-core:importedFrom"));

      /*
       * define XSD mappings for simple types.
       *
       * TODO we should also have additional IValue types with validation for negative and
       * positive numbers, URL, ID etc, just like in XSD.
       */
      xsdMappings.put(XSDVocabulary.STRING.toString(), textTypeID.toString());
      xsdMappings.put(XSDVocabulary.FLOAT.toString(), floatTypeID.toString());
      xsdMappings.put(XSDVocabulary.DOUBLE.toString(), doubleTypeID.toString());
      xsdMappings.put(XSDVocabulary.LONG.toString(), longTypeID.toString());
      xsdMappings.put(XSDVocabulary.INT.toString(), integerTypeID.toString());
      xsdMappings.put(XSDVocabulary.INTEGER.toString(), integerTypeID.toString());
      xsdMappings.put(XSDVocabulary.SHORT.toString(), integerTypeID.toString());
      xsdMappings.put(XSDVocabulary.STRING.toString(), textTypeID.toString());
      xsdMappings.put(XSDVocabulary.BOOLEAN.toString(), booleanTypeID.toString());

    } catch (ThinklabRuntimeException e1) {
      throw new ThinklabValidationException("configuration error: " + e1.getMessage());
    }

    /* retrieve actual concepts from semantic types */
    try {
      integerType = requireConcept(integerTypeID);
      floatType = requireConcept(floatTypeID);
      textType = requireConcept(textTypeID);
      longType = requireConcept(longTypeID);
      doubleType = requireConcept(doubleTypeID);
      numberType = requireConcept(numberTypeID);
      booleanType = requireConcept(booleanTypeID);
      literalType = requireConcept(literalTypeID);
      booleanRankingType = requireConcept(booleanRankingTypeID);
      ordinalRankingType = requireConcept(ordinalRankingTypeID);
      ordinalRangeMappingType = requireConcept(ordinalRangeMappingTypeID);
      operatorType = requireConcept(operatorTypeID);

      classificationProperty = requireProperty(classificationPropertyID);
      reifiedLiteralProperty = requireProperty(reifiedLiteralPropertyID);
      additionalRestrictionsProperty = requireProperty(additionalRestrictionsPropertyID);
      abstractProperty = requireProperty(abstractPropertyID);
      importedProperty = requireProperty(importedPropertyID);

    } catch (ThinklabResourceNotFoundException e) {
      throw new ThinklabValidationException(
          "core type specifications are incomplete: " + e.getMessage());
    }

    typesInitialized = true;
  }