本文整理汇总了Java中com.hp.hpl.jena.vocabulary.OWL类的典型用法代码示例。如果您正苦于以下问题:Java OWL类的具体用法?Java OWL怎么用?Java OWL使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OWL类属于com.hp.hpl.jena.vocabulary包,在下文中一共展示了OWL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: exportEnumerationTypeInfo
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
private void exportEnumerationTypeInfo(IfcEnumerationTypeInfo typeInfo) {
String typeUri = super.formatTypeName(typeInfo);
Resource typeResource = createUriResource(typeUri);
if (!context.isEnabledOption(Ifc2RdfConversionOptionsEnum.ForceConvertEnumerationValuesToString)) {
adapter.exportTriple(typeResource, RDF.type, OWL.Class);
List<Resource> nodes = new ArrayList<>();
List<String> enumValues = typeInfo.getValues();
for (String value : enumValues) {
nodes.add(super.createUriResource(super.formatOntologyName(value)));
}
RDFList rdfList = super.createList(nodes);
adapter.exportTriple(typeResource, OWL.oneOf, rdfList);
} else {
adapter.exportTriple(typeResource, RDF.type, RDFS.Datatype);
adapter.exportTriple(typeResource, RDFS.subClassOf, XSD.xstring);
// List<String> values = typeInfo.getValues();
// String valueString = StringUtils.collectionToString(values, "(", ")", String.format("\"%%s\"^^%s", RdfVocabulary.XSD_STRING.getShortForm()), " ");
// adapter.writeRdfTriple(ExportAdapter.CURRENT_SUBJECT, OWL.oneOf, valueString);
}
}
示例2: exportSelectTypeInfo
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
private void exportSelectTypeInfo(IfcSelectTypeInfo typeInfo) {
Resource typeResource = super.createUriResource(super.formatTypeName(typeInfo));
adapter.exportTriple(typeResource, RDF.type, OWL.Class);
List<String> subTypeNames = typeInfo.getSelectTypeInfoNames();
List<Resource> nodes = new ArrayList<>();
for (String typeName : subTypeNames) {
nodes.add(super.createUriResource(super.formatOntologyName(typeName)));
}
RDFList rdfList = super.createList(nodes);
// See samples: [2, p.250]
adapter.exportTriple(typeResource, OWL.unionOf, rdfList);
// See samples: [2, pp.135-136]
// for (String subTypeName : subTypeNames) {
// writeSentence(generateName(subTypeName), RDFS.subClassOf, typeName);
// }
}
示例3: supportXsdType
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
public boolean supportXsdType(Resource type) {
if (owlProfileId == OwlProfileEnum.OWL2_EL || owlProfileId == OwlProfileEnum.OWL2_QL) {
if (type.equals(XSD.xboolean) || type.equals(XSD.xdouble)) {
//
// The following datatypes must not be used in OWL 2 EL and OWL 2 QL) ||
// xsd) ||boolean, xsd) ||double, xsd) ||float, xsd) ||XXXInteger (exception xsd) ||integer and xsd) ||nonNegativeInteger),
// xsd) ||long, xsd) ||int, xsd) ||short, xsd) ||byte, xsd) ||unsignedXXX, xsd) ||language
// See) || http) ||//www.w3.org/TR/owl2-profiles/#Entities
// See) || http) ||//www.w3.org/TR/owl2-profiles/#Entities2
//
return false;
}
} else if (owlProfileId == OwlProfileEnum.OWL2_RL) {
if (type.equals(RdfVocabulary.OWL.real)) {
return false;
}
}
//
// OWL1 supports almost all types) ||
// See) || http) ||//www.w3.org/TR/owl-ref/#rdf-datatype
//
return true;
}
示例4: getXsdTypeForDoubleValues
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
protected Resource getXsdTypeForDoubleValues() {
if (typeForDoubleValues == null) {
List<Resource> types = new ArrayList<>();
if (context.isEnabledOption(Ifc2RdfConversionOptionsEnum.UseSpecificDoubleTypes)) {
types.add(XSD.xdouble);
types.add(RdfVocabulary.OWL.real);
}
types.add(XSD.decimal);
typeForDoubleValues = context.getOwlProfileList().getFirstSupportedType(types);
}
return typeForDoubleValues;
}
示例5: exportLiteralTypeInfo
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
private void exportLiteralTypeInfo(IfcLiteralTypeInfo typeInfo) {
Resource typeResource = super.createUriResource(formatTypeName(typeInfo));
// adapter.exportTriple(typeResource, RDF.type, RDFS.Datatype);
// adapter.exportTriple(typeResource, OWL.sameAs, super.getXsdDataType(typeInfo));
adapter.exportTriple(typeResource, RDF.type, OWL.Class);
Resource xsdDataType = super.getXsdDataType(typeInfo);
Property property = getHasProperty(typeInfo);
adapter.exportTriple(property, RDF.type, OWL.DatatypeProperty);
if (owlProfileList.supportsRdfProperty(OWL.FunctionalProperty, null)) {
adapter.exportTriple(property, RDF.type, RdfVocabulary.OWL.FunctionalDataProperty);
}
adapter.exportTriple(property, RDFS.subPropertyOf, Ifc2RdfVocabulary.EXPRESS.hasValue);
adapter.exportTriple(property, RDFS.domain, typeResource);
adapter.exportTriple(property, RDFS.range, xsdDataType);
// if (owlProfileList.supportsRdfProperty(OWL.allValuesFrom, null)) {
//
// writePropertyRestriction(typeResource, Ifc2RdfVocabulary.EXPRESS.value, OWL.allValuesFrom, super.getXsdDataType((IfcLiteralTypeInfo)baseTypeInfo));
//
// }
}
示例6: exportLogicalTypeInfo
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
private void exportLogicalTypeInfo(IfcLogicalTypeInfo typeInfo) {
String typeUri = super.formatExpressOntologyName(typeInfo.getName());
Resource typeResource = createUriResource(typeUri);
adapter.exportTriple(typeResource, RDF.type, OWL.Class);
List<String> enumValues = typeInfo.getValues();
List<RDFNode> enumValueNodes = new ArrayList<>();
for (String value : enumValues) {
enumValueNodes.add(super.createUriResource(super.formatExpressOntologyName(value)));
}
if (owlProfileList.supportsRdfProperty(OWL.oneOf, EnumSet.of(RdfTripleObjectTypeEnum.ZeroOrOneOrMany))) {
RDFList rdfList = super.createList(enumValueNodes);
adapter.exportTriple(typeResource, OWL.oneOf, rdfList);
} else { // if (!context.isEnabledOption(Ifc2RdfConversionOptionsEnum.ForceConvertLogicalValuesToString)) {
enumValueNodes.stream().forEach(node ->
adapter.exportTriple((Resource)node, RDF.type, typeResource));
}
}
示例7: exportEnumerationTypeInfo
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
private void exportEnumerationTypeInfo(IfcEnumerationTypeInfo typeInfo) {
String typeUri = super.formatTypeName(typeInfo);
Resource typeResource = createUriResource(typeUri);
adapter.exportTriple(typeResource, RDF.type, OWL.Class);
adapter.exportTriple(typeResource, RDFS.subClassOf, Ifc2RdfVocabulary.EXPRESS.Enum);
List<String> enumValues = typeInfo.getValues();
List<RDFNode> enumValueNodes = new ArrayList<>();
for (String value : enumValues) {
enumValueNodes.add(super.createUriResource(super.formatOntologyName(value)));
}
if (owlProfileList.supportsRdfProperty(OWL.oneOf, EnumSet.of(RdfTripleObjectTypeEnum.ZeroOrOneOrMany))) {
Resource equivalentTypeResource = super.createAnonResource();
adapter.exportTriple(typeResource, OWL.equivalentClass, equivalentTypeResource);
RDFList rdfList = super.createList(enumValueNodes);
adapter.exportTriple(equivalentTypeResource, OWL.oneOf, rdfList);
} else { // if (!context.isEnabledOption(Ifc2RdfConversionOptionsEnum.ForceConvertEnumerationValuesToString)) {
enumValueNodes.stream().forEach(node ->
adapter.exportTriple((Resource)node, RDF.type, typeResource));
}
}
示例8: exportSelectTypeInfo
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
private void exportSelectTypeInfo(IfcSelectTypeInfo typeInfo) {
Resource typeResource = super.createUriResource(super.formatTypeName(typeInfo));
adapter.exportTriple(typeResource, RDF.type, OWL.Class);
adapter.exportTriple(typeResource, RDFS.subClassOf, Ifc2RdfVocabulary.EXPRESS.Select);
List<String> subTypeNames = typeInfo.getSelectTypeInfoNames();
List<Resource> subTypeResources = new ArrayList<>();
for (String typeName : subTypeNames) {
subTypeResources.add(super.createUriResource(super.formatOntologyName(typeName)));
}
if (owlProfileList.supportsRdfProperty(OWL.unionOf, EnumSet.of(RdfTripleObjectTypeEnum.ZeroOrOneOrMany)) && subTypeResources.size() > 1) {
RDFList rdfList = super.createList(subTypeResources);
// See samples: [2, p.250]
adapter.exportTriple(typeResource, OWL.unionOf, rdfList);
} else {
subTypeResources.stream().forEach(subTypeResource ->
adapter.exportTriple((Resource)subTypeResource, RDFS.subClassOf, typeResource));
}
}
示例9: findUnlinkedDolceClasses
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
protected static Set<Resource> findUnlinkedDolceClasses(Model classesModel, Model dolceClassModel) {
Set<Resource> unlinkedClasses = new HashSet<Resource>();
StmtIterator stmtIterator = dolceClassModel.listStatements(null, RDF.type, RDFS.Class);
Statement statement;
Resource resource;
while (stmtIterator.hasNext()) {
statement = stmtIterator.next();
resource = statement.getSubject();
// If this class has no equivalent class and no sub classes
if ((!classesModel.contains(resource, OWL.equivalentClass))
&& (!classesModel.contains(null, OWL.equivalentClass, resource))
&& (!classesModel.contains(null, RDFS.subClassOf, resource))) {
unlinkedClasses.add(resource);
}
}
// We are searching the higher classes on the complete model to make
// sure, that higher DOLCE classes are only added to the list of
// unlinked classes, if they do not have a YAGO sub class
// FIXME If a DOLCE class has an equal YAGO class and both have no
// children, the DOLCE class will be added to the list of unlinked
// classes. (very unlikely, but possible)
addHigherIncludedDolceClass(unlinkedClasses, classesModel, unlinkedClasses);
return unlinkedClasses;
}
示例10: getClasses
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
protected Set<Resource> getClasses(Model readModel) {
ResIterator iterator = readModel.listSubjectsWithProperty(RDF.type, RDFS.Class);
Resource r;
Set<Resource> classes = new HashSet<Resource>();
while (iterator.hasNext()) {
r = iterator.next();
if (!r.isAnon()) {
classes.add(r);
}
}
iterator = readModel.listSubjectsWithProperty(RDF.type, OWL.Class);
while (iterator.hasNext()) {
r = iterator.next();
if (!r.isAnon()) {
classes.add(r);
}
}
return classes;
}
示例11: extractMarkings
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
public static List<ExtendedTypedNamedEntity> extractMarkings(Document document) {
MarkingFilter<TypedNamedEntity> filter = new TypeBasedMarkingFilter<TypedNamedEntity>(true, RDFS.Class.getURI(),
OWL.Class.getURI());
List<TypedNamedEntity> namedEntities = document.getMarkings(TypedNamedEntity.class);
List<ExtendedTypedNamedEntity> extendedMarkings = new ArrayList<ExtendedTypedNamedEntity>();
int start, length, end;
for (TypedNamedEntity tne : namedEntities) {
if (filter.isMarkingGood(tne)) {
start = tne.getStartPosition();
length = tne.getLength();
end = start + length;
extendedMarkings.add(new ExtendedTypedNamedEntity(start, length, tne.getUris(), new HashSet<String>(),
document.getText().substring(start, end)));
}
}
return extendedMarkings;
}
示例12: createModel
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
private static Model createModel() {
Model classModel = ModelFactory.createDefaultModel();
Resource A = classModel.createResource("http://example.org/A");
Resource B = classModel.createResource("http://example.org/B");
Resource C = classModel.createResource("http://example.org/C");
Resource C2 = classModel.createResource("http://example2.org/C");
Resource C3 = classModel.createResource("http://example3.org/C");
Resource D2 = classModel.createResource("http://example2.org/D");
Resource D3 = classModel.createResource("http://example3.org/D");
classModel.add(A, RDF.type, RDFS.Class);
classModel.add(B, RDF.type, RDFS.Class);
classModel.add(C, RDF.type, RDFS.Class);
classModel.add(C2, RDF.type, RDFS.Class);
classModel.add(C3, RDF.type, RDFS.Class);
classModel.add(D2, RDF.type, RDFS.Class);
classModel.add(D3, RDF.type, RDFS.Class);
classModel.add(B, RDFS.subClassOf, A);
classModel.add(C, RDFS.subClassOf, B);
classModel.add(C, OWL.sameAs, C2);
classModel.add(C3, OWL.equivalentClass, C);
classModel.add(D2, RDFS.subClassOf, C2);
classModel.add(D3, RDFS.subClassOf, C3);
return classModel;
}
示例13: initIndividuals
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
/**
* This method finds all individuals (= instances of owl:Class)
*
* @param dataset
*/
private void initIndividuals(SparqlifyDataset dataset) {
String indivQueryStr =
"SELECT distinct ?indiv {" +
"?indiv a ?cls . ?cls a <" + OWL.Class.getURI() + "> }";
Query indivQuery = QueryFactory.create(indivQueryStr);
QueryExecution indivQe;
if (dataset.isSparqlService() && dataset.getSparqlServiceUri()!=null) {
indivQe = QueryExecutionFactory.createServiceRequest(
dataset.getSparqlServiceUri(), indivQuery);
} else {
indivQe = QueryExecutionFactory.create(indivQuery, dataset);
}
ResultSet indivRes = indivQe.execSelect();
while (indivRes.hasNext()) {
QuerySolution sol = indivRes.next();
Node indiv = sol.get("indiv").asNode();
individuals.add(indiv);
}
}
示例14: NameMapper
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
public NameMapper(String aimURI) {
super();
for(Type t : Type.values()) {
count.put(t, 1);
listByType.put(t, new TreeSet<>());
}
// for comodity, the first element is always rdf:type
RDF_TYPE_NAME = this.add(RDF.type.getURI(), Type.RELATION);
logger.debug("Alias for rdf:type is " + RDF_TYPE_NAME);
// same for owl:Thing
OWL_THING_NAME = this.add(OWL.Thing.getURI(), Type.CLASS);
logger.debug("Alias for owl:Thing is " + OWL_THING_NAME);
this.aimURI = aimURI;
if(!aimURI.equals("*")) {
AIM_NAME = this.add(aimURI, Type.RELATION);
logger.debug("Alias for AIM ("+aimURI+") is " + AIM_NAME);
}
}
示例15: dataset12
import com.hp.hpl.jena.vocabulary.OWL; //导入依赖的package包/类
public SparqlifyDataset dataset12() {
String content =
"<http://ex.org/Class01> <" + RDF.type.getURI() + "> <" + RDFS.Class.getURI() + "> ." +
"<http://ex.org/Class02> <" + RDF.type.getURI() + "> <" + RDFS.Class.getURI() + "> ." +
"<http://ex.org/res/01> <" + RDF.type.getURI() + "> <http://ex.org/Class01> ." +
"<http://ex.org/res/02> <" + RDF.type.getURI() + "> <http://ex.org/Class02> ." +
"<http://ex.org/prop01> <" + RDF.type.getURI() + "> <" + OWL.DatatypeProperty.getURI() + "> ." +
"<http://ex.org/prop02> <" + RDF.type.getURI() + "> <" + RDF.Property.getURI() + "> ." +
"<http://ex.org/prop02> <http://ex.org/prop01> \"23\"^^<" + XSD.integer.getURI() + "> .";
SparqlifyDataset dataset = new SparqlifyDataset();
dataset.registerDump(new StringReader(content));
dataset.read(new StringReader(content), null, "TTL");
return dataset;
}