public OntClass resource() { synchronized (model) { return model.createClass(uri); } } };
public OntClass resource() { return model.createClass(uri); } };
/** * Creates an {@link OntClass} for a unique reference or returns the existing one. * * @param reference * Unique reference of object for which the {@link OntClass} is requested. * @return {@link OntClass} instance. */ public OntClass createOntClassByReference(String reference) { log.debug("Creating OWL Class for reference {}", reference); OntClass klass = null; try { klass = getOntClassByReference(reference); } catch (UnsupportedPolymorphismException e) { log.warn("Another type of resource has been created for the reference: {}", reference); return null; } catch (ConversionException e) { log.warn("Another type of resource has been created for the reference: {}", reference); return null; } if (klass == null) { String classURI = namingStrategy.getClassName(ontologyURI, reference); klass = ontModel.createClass(classURI); klass.addProperty(CMSAdapterVocabulary.CMSAD_RESOURCE_REF_PROP, reference); log.debug("OWL Class {} not found for reference. Creating new one...", reference); } return klass; }
OntModel model = ModelFactory.createOntologyModel(); model.createClass(jenadata.getURI());
@Override public RestrictionNode getInputRestrictionTree() throws SADIException, IOException { return new RestrictionNode(ModelFactory.createOntologyModel().createClass()) { private static final long serialVersionUID = 1L; @Override public String toString() { return "input"; } }; } @Override
@Override public RestrictionNode getOutputRestrictionTree() throws SADIException, IOException { return new RestrictionNode(ModelFactory.createOntologyModel().createClass()) { private static final long serialVersionUID = 1L; @Override public String toString() { return "output"; } }; } };
String ns = Namespaces.KARMA; autoOntology.setNsPrefix("karma", ns); OntClass topClass = autoOntology.createClass( ns + worksheet.getTitle().replaceAll(" ", "_")); // replace blank spaces with undrscore for (HNode hNode : sortedLeafHNodes){ DatatypeProperty dp = autoOntology.createDatatypeProperty(ns+hNode.getColumnName().trim().replaceAll(" ", "_"));
/** * Creates an {@link OntClass} for a {@link CMSObject} object or returns the existing one. * * @param cmsObject * {@link CMSObject} object for which the {@link OntClass} is requested. * @return {@link OntClass} instance. */ public OntClass createOntClassByCMSObject(CMSObject cmsObject) { log.debug("Getting OWL Class for cms object = {}", cmsObject); OntClass klass = null; try { klass = getOntClassByReference(cmsObject.getUniqueRef()); } catch (UnsupportedPolymorphismException e) { log.warn("Another type of resource has been created for the CMS object: {}", cmsObject.getLocalname()); return null; } catch (ConversionException e) { log.warn("Another type of resource has been created for the CMS object: {}", cmsObject.getLocalname()); return null; } if (klass == null) { String classURI = namingStrategy.getClassName(ontologyURI, cmsObject); klass = ontModel.createClass(classURI); klass.addProperty(CMSAdapterVocabulary.CMSAD_RESOURCE_REF_PROP, cmsObject.getUniqueRef()); log.debug("OWL Class {} not found creating...", classURI); } return klass; }
/** * Creates an {@link OntClass} for a {@link ObjectTypeDefinition} object or returns the existing one. * * @param objectTypeDefinition * {@link ObjectTypeDefinition} object for which the {@link OntClass} is requested. * @return {@link OntClass} instance. */ public OntClass createOntClassByObjectTypeDefinition(ObjectTypeDefinition objectTypeDefinition) { log.debug("Getting OWL Class for node type {}", objectTypeDefinition); OntClass klass = null; try { klass = getOntClassByReference(objectTypeDefinition.getUniqueRef()); } catch (UnsupportedPolymorphismException e) { log.warn("Another type of resource has been created for the object type definition: {}", objectTypeDefinition.getLocalname()); return null; } catch (ConversionException e) { log.warn("Another type of resource has been created for the object type definition: {}", objectTypeDefinition.getLocalname()); return null; } if (klass == null) { String classURI = namingStrategy.getClassName(ontologyURI, objectTypeDefinition); klass = ontModel.createClass(classURI); klass.addProperty(CMSAdapterVocabulary.CMSAD_RESOURCE_REF_PROP, objectTypeDefinition.getUniqueRef()); log.debug("OWL Class {} not found, creating new one...", classURI); } return klass; }
public OntClass addGroupTypeToOntModel(OntModel ontmodel, String groupType) { OntClass groupTypeRes = ontmodel.createClass(GINCO.getResource( groupType).getURI()); groupTypeRes.addLabel(ontmodel.createLiteral(GINCO.getResource( groupType).getLocalName())); groupTypeRes.addSuperClass(ontmodel.getResource(ISOTHES.CONCEPT_GROUP .getURI())); return groupTypeRes; }
OntClass pitfallClass = model.createClass( oops + "pitfall"); DatatypeProperty hasCodeDTP = model.createDatatypeProperty( oops + "hasCode");
OntClass rdfsSuperConceptClass = model.createClass(urlPrefixMetaData + "ConceptClass"); rdfsSuperConceptClass.addLabel("Concept Class", "en"); rdfsSuperConceptClass.addComment("The super for classes describing Concept types", "en"); OntClass rdfsClass = model.createClass(urlPrefixMetaData + cc.getId()); rdfsClass.addLabel(cc.getFullname(), "en"); rdfsClass.addComment(cc.getDescription(), "en");
public OntModel buildGroupOntologyModel(OntModel ontModel) { OntClass groupClass = ontModel.createClass(ISOTHES.CONCEPT_GROUP .getURI()); groupClass.addLabel(ontModel.createLiteral(ISOTHES.CONCEPT_GROUP .getLocalName())); groupClass.addSuperClass(SKOS.COLLECTION); ObjectProperty subGroup = ontModel .createObjectProperty(ISOTHES.SUB_GROUP.getURI()); subGroup.addLabel(ontModel.createLiteral(ISOTHES.SUB_GROUP .getLocalName())); subGroup.addRange(groupClass); subGroup.addDomain(groupClass); ObjectProperty superGroup = ontModel .createObjectProperty(ISOTHES.SUPER_GROUP.getURI()); superGroup.addLabel(ontModel.createLiteral(ISOTHES.SUPER_GROUP .getLocalName())); superGroup.addRange(groupClass.asResource()); superGroup.addDomain(groupClass.asResource()); return ontModel; }