当前位置: 首页>>代码示例>>Java>>正文


Java OWL2Datatype类代码示例

本文整理汇总了Java中org.semanticweb.owlapi.vocab.OWL2Datatype的典型用法代码示例。如果您正苦于以下问题:Java OWL2Datatype类的具体用法?Java OWL2Datatype怎么用?Java OWL2Datatype使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


OWL2Datatype类属于org.semanticweb.owlapi.vocab包,在下文中一共展示了OWL2Datatype类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createLiteralInternal

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
private static OWLLiteral createLiteralInternal(JsonAnnotation ann, OWLDataFactory f) {
	OWLLiteral literal;
	OWL2Datatype datatype = null;
	for(OWL2Datatype current : OWL2Datatype.values()) {
		if (current.getPrefixedName().equalsIgnoreCase(ann.valueType)
				|| current.getShortForm().equalsIgnoreCase(ann.valueType)) {
			datatype = current;
			break;
		}
	}
	if (datatype != null) {
		literal = f.getOWLLiteral(ann.value, datatype);
	}
	else {
		literal = f.getOWLLiteral(ann.value);
	}
	return literal;
}
 
开发者ID:geneontology,项目名称:minerva,代码行数:19,代码来源:JsonTools.java

示例2: createOWLLiteralFromValue

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
/**
 * Creates OWLLiteral from the specified Java instance.
 *
 * @param value       The value to transform
 * @param dataFactory Data factory
 * @param lang        Ontology language
 * @return OWLLiteral representing the value
 * @throws IllegalArgumentException If {@code value} is of unsupported type
 */
public static OWLLiteral createOWLLiteralFromValue(Object value, OWLDataFactory dataFactory, String lang) {
    Objects.requireNonNull(value);
    if (value instanceof Integer) {
        // Java implementations map int/Integer to xsd:int, because xsd:integer is unbounded, whereas xsd:int is 32-bit signed, same as Java
        return dataFactory.getOWLLiteral(value.toString(), OWL2Datatype.XSD_INT);
    } else if (value instanceof Long) {
        return dataFactory.getOWLLiteral(value.toString(), OWL2Datatype.XSD_LONG);
    } else if (value instanceof Boolean) {
        return dataFactory.getOWLLiteral((Boolean) value);
    } else if (value instanceof Double) {
        return dataFactory.getOWLLiteral((Double) value);
    } else if (value instanceof String) {
        return dataFactory.getOWLLiteral((String) value, lang);
    } else if (value instanceof Date) {
        SimpleDateFormat sdf = new SimpleDateFormat(DATE_TIME_FORMAT);
        return dataFactory.getOWLLiteral(sdf.format(((Date) value)),
                dataFactory.getOWLDatatype(OWL2Datatype.XSD_DATE_TIME.getIRI()));
    } else if (value.getClass().isEnum()) {
        return dataFactory.getOWLLiteral(value.toString());
    } else {
        throw new IllegalArgumentException("Unsupported value " + value + " of type " + value.getClass());
    }
}
 
开发者ID:kbss-cvut,项目名称:jopa,代码行数:33,代码来源:OwlapiUtils.java

示例3: testShouldSerializeOWLLiteralImplBoolean

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
public void testShouldSerializeOWLLiteralImplBoolean() {
    delayTestFinish(TEST_DELAY_MS);
    final OWLLiteralImplBoolean in = new OWLLiteralImplBoolean(true, new OWL2DatatypeImpl(OWL2Datatype.XSD_BOOLEAN));
    OWLObjectSerializationTestsServiceAsync service = GWT.create(OWLObjectSerializationTestsService.class);
    service.testOWLLiteralImplBoolean(in, new AsyncCallback<OWLLiteralImplBoolean>() {
        @Override
        public void onFailure(Throwable throwable) {
            fail(throwable.getMessage());
        }

        @Override
        public void onSuccess(OWLLiteralImplBoolean out) {
            assertEquals(in, out);
            finishTest();
        }
    });
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:18,代码来源:GwtTest_OWLObject_Serialization.java

示例4: testShouldSerializeOWL2DatatypeImpl

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
public void testShouldSerializeOWL2DatatypeImpl() {
    delayTestFinish(TEST_DELAY_MS);
    final OWL2DatatypeImpl in = new OWL2DatatypeImpl(OWL2Datatype.RDF_PLAIN_LITERAL);
    OWLObjectSerializationTestsServiceAsync service = GWT.create(OWLObjectSerializationTestsService.class);
    service.testOWL2DatatypeImpl(in, new AsyncCallback<OWL2DatatypeImpl>() {
        @Override
        public void onFailure(Throwable throwable) {
            fail(throwable.getMessage());
        }

        @Override
        public void onSuccess(OWL2DatatypeImpl out) {
            assertEquals(in, out);
            finishTest();
        }
    });
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:18,代码来源:GwtTest_OWLObject_Serialization.java

示例5: testShouldSerializeOWLLiteralImplFloat

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
@Override
public void testShouldSerializeOWLLiteralImplFloat() {
    delayTestFinish(TEST_DELAY_MS);
    final OWLLiteralImplFloat in = new OWLLiteralImplFloat(33.0f, new OWL2DatatypeImpl(OWL2Datatype.XSD_FLOAT));
    OWLObjectSerializationTestsServiceAsync service = GWT.create(OWLObjectSerializationTestsService.class);
    service.testOWLLiteralImplFloat(in, new AsyncCallback<OWLLiteralImplFloat>() {
        @Override
        public void onFailure(Throwable throwable) {
            fail(throwable.getMessage());
        }

        @Override
        public void onSuccess(OWLLiteralImplFloat out) {
            assertEquals(in, out);
            finishTest();
        }
    });
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:19,代码来源:GwtTest_OWLObject_Serialization.java

示例6: testShouldSerializeOWLFacetRestrictionImpl

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
@Override
public void testShouldSerializeOWLFacetRestrictionImpl() {
    delayTestFinish(TEST_DELAY_MS);
    final OWLFacetRestrictionImpl in = new OWLFacetRestrictionImpl(OWLFacet.LENGTH, new OWLLiteralImplInteger(33, new OWL2DatatypeImpl(OWL2Datatype.XSD_INTEGER)));
    OWLObjectSerializationTestsServiceAsync service = GWT.create(OWLObjectSerializationTestsService.class);
    service.testOWLFacetRestrictionImpl(in, new AsyncCallback<OWLFacetRestrictionImpl>() {
        @Override
        public void onFailure(Throwable throwable) {
            fail(throwable.getMessage());
        }

        @Override
        public void onSuccess(OWLFacetRestrictionImpl out) {
            assertEquals(in, out);
            finishTest();
        }
    });
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:19,代码来源:GwtTest_OWLObject_Serialization.java

示例7: testShouldSerializeOWL2Datatype

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
public void testShouldSerializeOWL2Datatype() {
    delayTestFinish(TEST_DELAY_MS);
    final OWL2Datatype in = OWL2Datatype.OWL_RATIONAL;
    OWLObjectSerializationTestsServiceAsync service = GWT.create(OWLObjectSerializationTestsService.class);
    service.testOWL2Datatype(in, new AsyncCallback<OWL2Datatype>() {
        @Override
        public void onFailure(Throwable throwable) {
            fail(throwable.getMessage());
        }

        @Override
        public void onSuccess(OWL2Datatype out) {
            assertEquals(in, out);
            finishTest();
        }
    });
}
 
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:18,代码来源:GwtTest_OWLObject_Serialization.java

示例8: PelletOWL2ELProfile

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
public PelletOWL2ELProfile() {
  allowedDatatypes = new HashSet<IRI>();
  allowedDatatypes.add(OWLRDFVocabulary.RDF_XML_LITERAL.getIRI());
  allowedDatatypes.add(OWLRDFVocabulary.RDFS_LITERAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.OWL_RATIONAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.OWL_REAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_DECIMAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_DECIMAL.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_INTEGER.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NON_NEGATIVE_INTEGER.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_STRING.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NORMALIZED_STRING.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_TOKEN.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NAME.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NCNAME.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_NMTOKEN.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_HEX_BINARY.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_BASE_64_BINARY.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_ANY_URI.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_DATE_TIME.getIRI());
  allowedDatatypes.add(OWL2Datatype.XSD_DATE_TIME_STAMP.getIRI());
}
 
开发者ID:ag-csw,项目名称:SVoNt,代码行数:23,代码来源:PelletOWL2ELProfile.java

示例9: convertToType

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
/**
 * Static method for converting OWL2Datatypes to equivalent java strings
 * 
 * @param dt
 * @return String
 */
public static String convertToType(OWL2Datatype dt) {
	switch (dt) {
		case XSD_SHORT:
			return "short";
		case XSD_INT:
		case XSD_INTEGER:
			return "int";
		case XSD_LONG:
			return "long";
		case XSD_FLOAT:
			return "float";
		case XSD_DOUBLE:
			return "double";
		case XSD_BOOLEAN:
			return "boolean";
		case XSD_STRING:
			return "String";
		case XSD_DATE_TIME:
			return "DateTime";
		default:
			return "/* Unsupported data type */";
	}
}
 
开发者ID:rzontar,项目名称:swrools,代码行数:30,代码来源:NameHelper.java

示例10: addCompatibleOwl2DatatypeFeatures

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
protected void addCompatibleOwl2DatatypeFeatures(List<OWL2Datatype> datatypes) {
  List<String> datatypeIris = datatypes.stream()
      .map(OWL2Datatype::getPrefixedName)
      .collect(Collectors.toList());

  List<Class<? extends Feature>> datatypeClasses = featureMapping.getAll().stream()
      .filter(f -> datatypeIris.contains(f.getName()))
      .map(Feature::getClass)
      .collect(Collectors.toList());

  addFeatures(datatypeClasses);
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:13,代码来源:Owl2Preset.java

示例11: addToOntology

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLDataProperty property = factory.getOWLDataProperty(":dataExactQualifiedCardinality", pm);
  OWLDatatype datatype = OWL2Datatype.XSD_STRING.getDatatype(factory);
  addToGenericDomainAndNewRange(property, datatype);

  OWLDatatype affectedDatatype = OWL2Datatype.XSD_DATE_TIME.getDatatype(factory);
  OWLDataExactCardinality cardinality = factory.getOWLDataExactCardinality(12, property, affectedDatatype);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(featurePool.getExclusiveClass(":DataExactQualifiedCardinalityRange"), cardinality));
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:12,代码来源:OwlDataQualifiedCardinalityFeature.java

示例12: addToOntology

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLDataProperty property = factory.getOWLDataProperty(":dataMaxQualifiedCardinality_RL", pm);
  OWLDatatype datatype = OWL2Datatype.RDFS_LITERAL.getDatatype(factory);
  addToGenericDomainAndNewRange(property, datatype);

  OWLDatatype affectedDatatype = OWL2Datatype.XSD_BYTE.getDatatype(factory);
  OWLDataMaxCardinality cardinality = factory.getOWLDataMaxCardinality(1, property, affectedDatatype);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(featurePool.getExclusiveClass(":DataMaxQualifiedCardinalityRange_RL"), cardinality));
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:12,代码来源:OwlDataMaxQualifiedCardinalityOwl2RlFeature.java

示例13: addToOntology

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLDataProperty property = factory.getOWLDataProperty(":dataMinCardinality", pm);
  OWLDatatype datatype = OWL2Datatype.XSD_BOOLEAN.getDatatype(factory);
  addToGenericDomainAndNewRange(property, datatype);

  OWLClass range = featurePool.getExclusiveClass(":DataMinCardinalityRange");
  OWLDataMinCardinality cardinality = factory.getOWLDataMinCardinality(3, property);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, cardinality));
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:12,代码来源:OwlDataMinCardinalityFeature.java

示例14: addToOntology

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLDataProperty property = factory.getOWLDataProperty(":dataMinQualifiedCardinality", pm);
  OWLDatatype datatype = OWL2Datatype.XSD_FLOAT.getDatatype(factory);
  addToGenericDomainAndNewRange(property, datatype);

  OWLDatatype affectedDatatype = OWL2Datatype.XSD_DATE_TIME.getDatatype(factory);
  OWLDataMinCardinality cardinality = factory.getOWLDataMinCardinality(9, property, affectedDatatype);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(featurePool.getExclusiveClass(":DataMinQualifiedCardinalityRange"), cardinality));
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:12,代码来源:OwlDataMinQualifiedCardinalityFeature.java

示例15: addToOntology

import org.semanticweb.owlapi.vocab.OWL2Datatype; //导入依赖的package包/类
@Override
public void addToOntology() {
  OWLDataProperty property = factory.getOWLDataProperty(":dataMaxCardinality_RL", pm);
  OWLDatatype datatype = OWL2Datatype.XSD_FLOAT.getDatatype(factory);
  addToGenericDomainAndNewRange(property, datatype);

  OWLClass range = featurePool.getExclusiveClass(":DataMaxCardinalityRange_RL");
  OWLDataMaxCardinality cardinality = factory.getOWLDataMaxCardinality(1, property);

  addAxiomToOntology(factory.getOWLSubClassOfAxiom(range, cardinality));
}
 
开发者ID:VisualDataWeb,项目名称:OntoBench,代码行数:12,代码来源:OwlDataMaxCardinalityOwl2RlFeature.java


注:本文中的org.semanticweb.owlapi.vocab.OWL2Datatype类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。