本文整理汇总了Java中org.apache.jena.vocabulary.OWL类的典型用法代码示例。如果您正苦于以下问题:Java OWL类的具体用法?Java OWL怎么用?Java OWL使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
OWL类属于org.apache.jena.vocabulary包,在下文中一共展示了OWL类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GraphCreator
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
public GraphCreator() {
// Initialize the classes
classes = new ObjectObjectOpenHashMap<Resource, HierarchyNode>();
classes.put(RDFS.Class, new HierarchyNode());
classes.put(OWL.Class, new HierarchyNode());
classes.put(RDF.Property, new HierarchyNode());
vertexPalette = new InMemoryPalette();
vertexPalette.addColour(RDFS.Class.getURI());
vertexPalette.setColour(OWL.Class.getURI(), vertexPalette.getColour(RDFS.Class.getURI()));
vertexPalette.addColour(RDF.Property.getURI());
// Initialize the properties
properties = new ObjectObjectOpenHashMap<Resource, HierarchyNode>();
properties.put(RDF.type, new HierarchyNode());
edgePalette = new InMemoryPalette();
edgePalette.addColour(RDF.type.getURI());
}
示例2: OntologyModel
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
private OntologyModel(Model m, Options o, ShapeChangeResult r,
String xmlprefix, OWLISO19150 owliso19150) {
this.model = m;
this.options = o;
this.result = r;
this.prefix = xmlprefix;
this.owliso19150 = owliso19150;
this.config = this.owliso19150.getConfig();
this.ontmodel.setNsPrefix("rdf", OWLISO19150.RDF_NS_W3C_RDF);
this.ontmodel.setNsPrefix("rdfs", OWLISO19150.RDF_NS_W3C_RDFS);
this.ontmodel.setNsPrefix("owl", OWLISO19150.RDF_NS_W3C_OWL);
this.ontmodel.setNsPrefix("xsd", OWLISO19150.RDF_NS_W3C_XML_SCHEMA);
if (owliso19150.getDefaultTypeImplementation() == null) {
defaultTypeImplementation = OWL.Class;
result.addInfo(this, 40, "owl:Class");
} else {
String dti = owliso19150.getDefaultTypeImplementation();
defaultTypeImplementation = mapClass(dti);
result.addInfo(this, 40, dti);
}
}
示例3: createCardinalityRestriction
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
public OntClass createCardinalityRestriction(OntProperty p,
int cardinality) {
/*
* NOTE: the create(Min|Max)CardinalityRestriction(...) methods from
* Jena - or the turtle serialization - encodes the cardinality as an
* xsd:int, which should be an xsd:nonNegativeInteger according to
* https://www.w3.org/TR/owl2-mapping-to-rdf/
*
* That's why we create and set the typed literal that represents the
* cardinality ourselves.
*/
OntClass restriction = this.ontmodel.createCardinalityRestriction(null,
p, cardinality);
restriction.removeAll(OWL.cardinality);
Literal cardAsNonNegativeInteger = ontmodel.createTypedLiteral(
cardinality,
"http://www.w3.org/2001/XMLSchema#nonNegativeInteger");
restriction.addLiteral(OWL.cardinality, cardAsNonNegativeInteger);
return restriction;
}
示例4: createMinCardinalityRestriction
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
public OntClass createMinCardinalityRestriction(OntProperty p,
int cardinality) {
/*
* NOTE: the create(Min|Max)CardinalityRestriction(...) methods from
* Jena - or the turtle serialization - encodes the cardinality as an
* xsd:int, which should be an xsd:nonNegativeInteger according to
* https://www.w3.org/TR/owl2-mapping-to-rdf/
*
* That's why we create and set the typed literal that represents the
* cardinality ourselves.
*/
OntClass restriction = this.ontmodel
.createMinCardinalityRestriction(null, p, cardinality);
restriction.removeAll(OWL.minCardinality);
Literal cardAsNonNegativeInteger = ontmodel.createTypedLiteral(
cardinality,
"http://www.w3.org/2001/XMLSchema#nonNegativeInteger");
restriction.addLiteral(OWL.minCardinality, cardAsNonNegativeInteger);
return restriction;
}
示例5: createMaxCardinalityRestriction
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
public OntClass createMaxCardinalityRestriction(OntProperty p,
int cardinality) {
/*
* NOTE: the create(Min|Max)CardinalityRestriction(...) methods from
* Jena - or the turtle serialization - encodes the cardinality as an
* xsd:int, which should be an xsd:nonNegativeInteger according to
* https://www.w3.org/TR/owl2-mapping-to-rdf/
*
* That's why we create and set the typed literal that represents the
* cardinality ourselves.
*/
OntClass restriction = this.ontmodel
.createMaxCardinalityRestriction(null, p, cardinality);
restriction.removeAll(OWL.maxCardinality);
Literal cardAsNonNegativeInteger = ontmodel.createTypedLiteral(
cardinality,
"http://www.w3.org/2001/XMLSchema#nonNegativeInteger");
restriction.addLiteral(OWL.maxCardinality, cardAsNonNegativeInteger);
return restriction;
}
示例6: listResourcesWithProperty
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
@Test
public void listResourcesWithProperty() {
Model model = ModelFactory.createDefaultModel();
RDFDataMgr.read(model, this.getClass().getResourceAsStream(PATH_PREFIX + "system.ttl"),
RDFLanguages.TURTLE);
List<Resource> actual = RDFUtils.listResourcesWithProperty(
model, RDF.type, SSN.System, Proto.Individual);
List<Resource> expected = new ArrayList<>();
expected.add(ResourceFactory.createResource("http://localhost/systems/3503522021"));
assertEquals(expected, actual);
assertEquals(0, RDFUtils.listResourcesWithProperty(
model, RDF.type, OWL.Class).size());
}
示例7: getImportedNamespace
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
private static String getImportedNamespace(Resource ontology, String prefix, Set<Resource> reached) {
reached.add(ontology);
for(Resource imp : JenaUtil.getResourceProperties(ontology, OWL.imports)) {
if(!reached.contains(imp)) {
String ns = getNamespace(imp, prefix);
if(ns == null) {
ns = getImportedNamespace(imp, prefix, reached);
}
if(ns != null) {
return ns;
}
}
}
return null;
}
示例8: addIncludes
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
private static void addIncludes(Graph model, String uri, Set<Graph> graphs, Set<String> reachedURIs) {
graphs.add(model);
reachedURIs.add(uri);
for(Triple t : model.find(null, OWL.imports.asNode(), null).toList()) {
if(t.getObject().isURI()) {
String includeURI = t.getObject().getURI();
if(!reachedURIs.contains(includeURI)) {
Model includeModel = ARQFactory.getNamedModel(includeURI);
if(includeModel != null) {
Graph includeGraph = includeModel.getGraph();
addIncludes(includeGraph, includeURI, graphs, reachedURIs);
}
}
}
}
}
示例9: collectTestCases
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
private static void collectTestCases(File folder, List<TestCase> testCases) throws Exception {
for(File f : folder.listFiles()) {
if(f.isDirectory()) {
collectTestCases(f, testCases);
}
else if(f.isFile() && f.getName().endsWith(".ttl")) {
Model testModel = JenaUtil.createDefaultModel();
InputStream is = new FileInputStream(f);
testModel.read(is, "urn:dummy", FileUtils.langTurtle);
testModel.add(SHACLSystemModel.getSHACLModel());
Resource ontology = testModel.listStatements(null, OWL.imports, ResourceFactory.createResource(DASH.BASE_URI)).next().getSubject();
for(TestCaseType type : TestCaseTypes.getTypes()) {
testCases.addAll(type.getTestCases(testModel, ontology));
}
}
}
}
示例10: test_OwlProfile
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
@Test
public void test_OwlProfile() {
OwlProfile owlProfile = new OwlProfile(OwlProfileEnum.OWL1_Lite);
assertFalse(owlProfile.isOwl2());
assertFalse(owlProfile.supportsStatement(OWL.complementOf, null));
assertFalse(owlProfile.supportsStatement(OWL2.hasKey, null));
assertFalse(owlProfile.supportsStatement(OWL.oneOf, null));
assertFalse(owlProfile.supportsStatement(OWL.unionOf, null));
assertFalse(owlProfile.supportsStatement(OWL.disjointWith, uri1));
assertFalse(owlProfile.supportsStatement(OWL.disjointWith, uriList));
assertTrue(owlProfile.supportsStatement(RDF.type, null));
assertTrue(owlProfile.supportDataType(XSD.xstring));
assertTrue(owlProfile.supportDataType(XSD.integer));
assertTrue(owlProfile.supportDataType(XSD.decimal));
assertTrue(owlProfile.supportDataType(XSD.dateTime));
assertTrue(owlProfile.supportDataType(XSD.xdouble));
assertTrue(owlProfile.supportDataType(XSD.xboolean));
assertFalse(owlProfile.supportDataType(RdfVocabulary.OWL.real));
}
示例11: test_SupportStatement_Owl1DL
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
@Test
public void test_SupportStatement_Owl1DL() {
OwlProfile owlProfile = new OwlProfile(OwlProfileEnum.OWL1_DL);
assertFalse(owlProfile.isOwl2());
assertTrue(owlProfile.supportsStatement(OWL.complementOf, null));
assertTrue(owlProfile.supportsStatement(OWL2.hasKey, null));
assertTrue(owlProfile.supportsStatement(OWL.oneOf, null));
assertTrue(owlProfile.supportsStatement(OWL.unionOf, null));
assertTrue(owlProfile.supportsStatement(OWL.disjointWith, uri1));
assertFalse(owlProfile.supportsStatement(OWL.disjointWith, uriList));
assertTrue(owlProfile.supportsStatement(RDF.type, null));
assertTrue(owlProfile.supportDataType(XSD.xstring));
assertTrue(owlProfile.supportDataType(XSD.integer));
assertTrue(owlProfile.supportDataType(XSD.decimal));
assertTrue(owlProfile.supportDataType(XSD.dateTime));
assertTrue(owlProfile.supportDataType(XSD.xdouble));
assertTrue(owlProfile.supportDataType(XSD.xboolean));
assertFalse(owlProfile.supportDataType(RdfVocabulary.OWL.real));
}
示例12: test_SupportStatement_Owl1Full
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
@Test
public void test_SupportStatement_Owl1Full() {
OwlProfile owlProfile = new OwlProfile(OwlProfileEnum.OWL1_Full);
assertFalse(owlProfile.isOwl2());
assertTrue(owlProfile.supportsStatement(OWL.complementOf, null));
assertTrue(owlProfile.supportsStatement(OWL2.hasKey, null));
assertTrue(owlProfile.supportsStatement(OWL.oneOf, null));
assertTrue(owlProfile.supportsStatement(OWL.unionOf, null));
assertTrue(owlProfile.supportsStatement(RDF.type, null));
assertTrue(owlProfile.supportsStatement(OWL.disjointWith, uri1));
assertFalse(owlProfile.supportsStatement(OWL.disjointWith, uriList));
assertTrue(owlProfile.supportDataType(XSD.xstring));
assertTrue(owlProfile.supportDataType(XSD.integer));
assertTrue(owlProfile.supportDataType(XSD.decimal));
assertTrue(owlProfile.supportDataType(XSD.dateTime));
assertTrue(owlProfile.supportDataType(XSD.xdouble));
assertTrue(owlProfile.supportDataType(XSD.xboolean));
assertFalse(owlProfile.supportDataType(RdfVocabulary.OWL.real));
}
示例13: test_SupportStatement_Owl2DL
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
@Test
public void test_SupportStatement_Owl2DL() {
OwlProfile owlProfile = new OwlProfile(OwlProfileEnum.OWL2_DL);
assertTrue(owlProfile.isOwl2());
assertTrue(owlProfile.supportsStatement(OWL.complementOf, null));
assertTrue(owlProfile.supportsStatement(OWL2.hasKey, null));
assertTrue(owlProfile.supportsStatement(OWL.oneOf, null));
assertTrue(owlProfile.supportsStatement(OWL.unionOf, null));
assertTrue(owlProfile.supportsStatement(RDF.type, null));
assertTrue(owlProfile.supportsStatement(OWL.disjointWith, uri1));
assertTrue(owlProfile.supportsStatement(OWL.disjointWith, uriList));
assertTrue(owlProfile.supportDataType(XSD.xstring));
assertTrue(owlProfile.supportDataType(XSD.integer));
assertTrue(owlProfile.supportDataType(XSD.decimal));
assertTrue(owlProfile.supportDataType(XSD.dateTime));
assertTrue(owlProfile.supportDataType(XSD.xdouble));
assertTrue(owlProfile.supportDataType(XSD.xboolean));
assertTrue(owlProfile.supportDataType(RdfVocabulary.OWL.real));
}
示例14: exportCollectionTypeInfoToDrummondList
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
private void exportCollectionTypeInfoToDrummondList(IfcCollectionTypeInfo typeInfo) {
if (typeInfo.isSorted()) {
Resource listTypeResource = createUriResource(formatTypeName(typeInfo));
jenaModel.add(listTypeResource, RDF.type, OWL.Class);
jenaModel.add(listTypeResource, RDFS.subClassOf, Ifc2RdfVocabulary.EXPRESS.List);
exportPropertyDefinition(Ifc2RdfVocabulary.EXPRESS.hasNext.inModel(jenaModel),
listTypeResource, listTypeResource, true, 1, 1);
Resource emptyListTypeResource = createUriResource(formatTypeName(typeInfo).replace("List", "EmptyList"));
jenaModel.add(emptyListTypeResource, RDF.type, OWL.Class);
jenaModel.add(emptyListTypeResource, RDFS.subClassOf, listTypeResource);
jenaModel.add(listTypeResource, RDFS.subClassOf, Ifc2RdfVocabulary.EXPRESS.EmptyList);
} else {
// TODO:
// throw new NotImplementedException(String.format("Unsorted list type: %s", typeInfo.getName()));
}
}
示例15: exportLogicalTypeInfo
import org.apache.jena.vocabulary.OWL; //导入依赖的package包/类
protected void exportLogicalTypeInfo(IfcLogicalTypeInfo typeInfo) {
String typeUri = formatExpressOntologyName(typeInfo.getName());
Resource typeResource = createUriResource(typeUri);
jenaModel.add(typeResource, RDF.type, OWL.Class);
List<LogicalEnum> enumValues = typeInfo.getValues();
List<RDFNode> enumValueNodes = new ArrayList<>();
for (LogicalEnum value : enumValues) {
enumValueNodes.add(createUriResource(formatExpressOntologyName(value.toString())));
}
final boolean enumerationIsSupported = owlProfileList.supportsStatement(OWL.oneOf, RdfVocabulary.DUMP_URI_LIST);
if (enumerationIsSupported) {
RDFList rdfList = createList(enumValueNodes);
jenaModel.add(typeResource, OWL.oneOf, rdfList);
} else { // if
// (!context.isEnabledOption(Ifc2RdfConversionParamsEnum.ForceConvertLogicalValuesToString))
// {
enumValueNodes.stream().forEach(
node -> jenaModel.add((Resource) node, RDF.type,
typeResource));
}
}