Refine search
OntClass clas ) { OntClass klass = model.createCardinalityRestriction( uri, prop, cardinality ); klass.removeAll( OWL.cardinality ); klass.addLiteral( OWL2.qualifiedCardinality, cardinality ); klass.addProperty( OWL2.onClass, clas ); return klass; OntClass k = model.createClass( NS+"Kolik_Fazovy" ); OntClass x = createCardinalityQRestriction(model, null, j, 1, k); test.addSuperClass( x ); model.write( System.out, "RDF/XML-ABBREV" );
/** * Extracts hierarchy data from the parent {@link OntClass} to ontClass {@link OntClass}. Updates the * {@link SolrInputDocument} for ontClass. * * @param doc the Solr input document * @param ontClass the ontology class * @param parent the parent of the ontology class */ private void extractNamedClassData(@Nonnull final SolrInputDocument doc, @Nonnull final OntClass ontClass, @Nonnull final OntClass parent) { // Note: in Orphanet, a subclass cannot have parents from different top categories (e.g. phenome and geography). if (!this.hierarchyRoots.contains(parent) && !hasHierarchyRootAsParent(parent, DIRECT)) { // This will not be null, since only anonymous classes have no local name. This check is performed in // the calling method (extractClassData). final String orphanetId = getFormattedOntClassId(parent.getLocalName()); // All parents are added to "term_category". addMultivaluedField(doc, TERM_CATEGORY_LABEL, orphanetId); // If parent is a direct super-class to ontClass, then want to also add the parent to the "is_a" category. if (ontClass.hasSuperClass(parent, DIRECT)) { addMultivaluedField(doc, IS_A_LABEL, orphanetId); } } }
private void recursivelyTraverse(OntClass values, HashSet<Class<? extends BioPAXElement>> set) { if (values.isUnionClass()) { UnionClass unionClass = values.asUnionClass(); ExtendedIterator iterator1 = unionClass.listOperands(); while (iterator1.hasNext()) { recursivelyTraverse((OntClass) iterator1.next(), set); } } else { set.add(extractClass(values)); } }
/** * Adds subsumption assertions to given two {@link OntClass}es mutually. * * @param parentClass * @param childClass */ public void addSubsumptionAssertion(OntClass parentClass, OntClass childClass) { parentClass.addSubClass(childClass); childClass.addSuperClass(parentClass); }
OntClass A = ...; OntClass B = ...; A.hasSuperClass(B); // Does A have B as a superclass? B.hasSubClass(A); // Does B have A as a subclass?
if (clazz.isRestriction()) { Restriction restriction = clazz.asRestriction(); if (!ignore.contains(restriction)) { OwlUtils.listRestrictions(clazz); RestrictionNode existingRestrictionNode = seenProperties.get(property); OntClass existingRestrictionClass = existingRestrictionNode.getOntClass(); if (existingRestrictionClass.hasSubClass(restrictionClass)) { node.remove(existingRestrictionNode); node.add(restrictionNode); seenProperties.put(property, restrictionNode); } else if (existingRestrictionClass.hasSuperClass(restrictionClass)) { if (clazz.isUnionClass()) { UnionClass unionClass = clazz.asUnionClass(); for (Iterator<?> i = unionClass.listOperands(); i.hasNext();) { buildRestrictionTree((OntClass) i.next(), seenClasses, node, seenProperties, ignore, true); } else if (clazz.isIntersectionClass()) { IntersectionClass intersectionClass = clazz.asIntersectionClass(); for (Iterator<?> i = intersectionClass.listOperands(); i.hasNext();) { buildRestrictionTree((OntClass) i.next(), seenClasses, node, seenProperties, ignore, exclusive); } else if (clazz.isComplementClass()) { ComplementClass complementClass = clazz.asComplementClass(); for (Iterator<?> i = complementClass.listOperands(); i.hasNext();) { buildRestrictionTree((OntClass) i.next(), seenClasses, node, seenProperties,
OntModel model = ModelFactory.createOntologyModel(); model.createClass(jenadata.getURI());
spec = OntModelSpec.RDFS_MEM_RDFS_INF; OntModel model = ModelFactory.createOntologyModel(spec); rdfsSuperConceptClass.addLabel("Concept Class", "en"); rdfsSuperConceptClass.addComment("The super for classes describing Concept types", "en"); rdfsClass.addLabel(cc.getFullname(), "en"); rdfsClass.addComment(cc.getDescription(), "en"); ConceptClass superClass = cc.getSpecialisationOf(); if (superClass != null) { rdfsClass.addSuperClass(model.getOntClass(urlPrefixMetaData + superClass.getId())); } else { rdfsClass.addSuperClass(rdfsSuperConceptClass);
@Override void extractClassData(@Nonnull final SolrInputDocument doc, @Nonnull final OntClass ontClass, @Nonnull final OntClass parent) { if (parent.isRestriction()) { extractRestrictionData(doc, parent); } else if (parent.isIntersectionClass()) { // For Orphanet, an intersection class only contains one or several related restrictions. extractIntersectionData(doc, ontClass, parent); } else if (!parent.isAnon()) { // If not a restriction, nor an intersection class, then try to extract as a named class (if not anonymous). extractNamedClassData(doc, ontClass, parent); } else { this.logger.warn("Parent class {} of {} is an anonymous class that is neither restriction nor intersection", parent.getId(), ontClass.getLocalName()); } }
if (c.isURIResource()) { resources.add(c); if (recursive) else if (c.isUnionClass()) { // in form of unionOf or intersectionOf UnionClass uc = c.asUnionClass(); for (Iterator<? extends OntClass> i = uc.listOperands(); i.hasNext(); ) { try { } else if (c.isIntersectionClass()) { IntersectionClass ic = c.asIntersectionClass(); for (Iterator<? extends OntClass> i = ic.listOperands(); i.hasNext(); ) { try {
public TurtleInputPanel(OntClass clazz) { this.clazz = clazz; this.setLayout(new BorderLayout()); this.add(new JScrollPane(turtleTextArea), CENTER); turtleTextArea.setText("<#changeme> a <" + clazz.getURI() + ">\n\n\n."); JPanel buttonPanel = new JPanel(); buttonPanel.setLayout(new BorderLayout()); JButton validateButton = new DeselectingButton(new AbstractAction( "Validate") { @Override public void actionPerformed(ActionEvent arg0) { getContentAsModel(); } }); buttonPanel.add(errors, CENTER); errors.setOpaque(false); buttonPanel.add(validateButton, EAST); this.add(buttonPanel, SOUTH); }
public void testReasoning() throws Exception { JenaProvenanceOntology ontology = new JenaProvenanceOntology(new File( INSTANCES_DIR, "test.owl").toURI()); OntModel ontModel = ontology.getOntModel(); ontModel.write(System.out); ExtendedIterator instances = ontModel.getOntClass( ProvenanceVocab.DATA_OBJECT.getURI()).listInstances(); int i = 0; while (instances.hasNext()) { Individual nextIndividual = (Individual) instances.next(); System.out.println(nextIndividual.getURI()); i++; } instances.close(); assertEquals("expected runs", 2, i); // Model plain = ModelFactory.createModelForGraph( ontModel.getGraph() // ); // plain.write( System.out, "RDF/XML" ); }
/** * <p>Add a sub-class of this class.</p> * @param cls A class that is a sub-class of this class. * @exception OntProfileException If the {@link Profile#SUB_CLASS_OF()} property is not supported in the current language profile. */ @Override public void addSubClass( Resource cls ) { cls.as( OntClass.class ).addSuperClass( this ); }
if (!c.isURIResource()) continue; if (!classes.containsKey(c.getURI())) classes.put(c.getURI(), ontHandler.getResourceLabel(c)); OntClass c = this.ontHandler.getOntModel().getOntClass(r.getURI()); if(c != null) classes.put(c.getURI(), ontHandler.getResourceLabel(c)); else classes.put(r.getURI(), ontHandler.getResourceLabel(r));
/** * Returns true iff an object of {@link OntClass} has one of the hierarchy roots as a parent. * * @param ontClass the restriction class * @param level specifies the level to search: direct iff true, traverse entire tree otherwise * @return true iff the someValuesFrom restriction value should be stored as a name */ private Boolean hasHierarchyRootAsParent(@Nonnull final OntClass ontClass, @Nonnull final Boolean level) { for (final OntClass hierarchyRoot : this.hierarchyRoots) { if (ontClass.hasSuperClass(hierarchyRoot, level)) { return true; } } return false; }
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; }
/** * Obtains the label for the {@link Restriction} of type {@link com.hp.hpl.jena.ontology.SomeValuesFromRestriction}. * * @param restriction the restriction being examined * @return the someValuesFrom restriction value as a string */ private String getSomeValuesFromRestriction(@Nonnull final Restriction restriction) { final OntClass ontClass = restriction.asSomeValuesFromRestriction().getSomeValuesFrom().as(OntClass.class); return !hasHierarchyRootAsParent(ontClass, !DIRECT) ? ontClass.getLabel(null) : getFormattedOntClassId(ontClass.getLocalName()); }
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; }
@Override Collection<OntClass> getRootClasses(@Nonnull final OntModel ontModel) { this.hierarchyRoots = ImmutableSet.<OntClass>builder() .add(ontModel.getOntClass(PHENOME_LABEL)) .add(ontModel.getOntClass(GENETIC_MATERIAL_LABEL)) .build(); final ImmutableSet.Builder<OntClass> selectedRoots = ImmutableSet.builder(); for (final OntClass hierarchyRoot : this.hierarchyRoots) { selectedRoots.addAll(hierarchyRoot.listSubClasses(DIRECT)); } return selectedRoots.build(); }
i = c.listSubClasses(true); } catch (ConversionException e) { logger.debug(e.getMessage()); if (subC.isURIResource()) { resources.add(subC); if (recursive)