Package com.hp.hpl.jena.ontology

Examples of com.hp.hpl.jena.ontology.OntClass


    // recurse to the next level down
    if (cls.canAs( OntClass.class &&  !occurs.contains( cls )) {
      //list subclasses
      for (Iterator i = cls.listSubClasses( true );  i.hasNext(); ) {
        OntClass sub = (OntClass) i.next();

        // we push this expression on the occurs list before we recurse
        occurs.add( cls );
        parseClass(sub, occurs, depth+1);
        occurs.remove( cls );
View Full Code Here


  public Iterator rootClasses( OntModel m ) {
    List roots = new ArrayList();
   
    for (Iterator i = m.listClasses();  i.hasNext(); ) {
      OntClass c = (OntClass) i.next();
       
      try {
      // too confusing to list all the restrictions as root classes
        if (c.isAnon()) {
          continue;
        }
   
        if (c.hasSuperClass( m.getProfile().THING(), true ) ) {
          // this class is directly descended from Thing
          roots.add( c );
        } else if (c.getCardinality( m.getProfile().SUB_CLASS_OF() ) == 0 ) {
          // this class has no super-classes
          // (can occur if we're not using the reasoner)
          roots.add( c );
        }
      } catch (Exception e) {
View Full Code Here

        }
      } else if (resource instanceof OntClass) {
        //list equivalent classes
        for (Iterator i=((OntClass)resource).listEquivalentClasses();
          i.hasNext();) {
          OntClass equivClass = (OntClass) i.next();
          //add labels
          for (Iterator j=equivClass.listLabels(null); j.hasNext();) {
            Literal l = (Literal) j.next();
            synonyms.put(l.toString(), "1");
          }
        }
      }
View Full Code Here

    out.println();
 
    // recurse to the next level down
    if (cls.canAs( OntClass.class ) && !occurs.contains( cls )) {
      for (Iterator i = cls.listSubClasses( true ); i.hasNext(); ) {
        OntClass sub = (OntClass) i.next();

        // we push this expression on the occurs list before we recurse
        occurs.add( cls );
        renderHierarchy( out, sub, occurs, depth + 1 );
        occurs.remove( cls );
View Full Code Here

   
    for (Iterator i = getParser().rootClasses( getModel() );
      i.hasNext(); ) {
   
      //print class
      OntClass c = (OntClass) i.next();

      renderHierarchy(System.out, c, new LinkedList(), 0);
    }

    String[] terms =
View Full Code Here

  /**
   * parse owl ontology files using jena
   */
  public void parse(OntModel m) {
    for (Iterator i = rootClasses( m );  i.hasNext()) {
      OntClass c = (OntClass) i.next();

      //dont deal with anonymous classes
      if (c.isAnon()) {
        continue;
      }

      parseClass( c,  new ArrayList(), 0 );
    }
View Full Code Here

    // recurse to the next level down
    if (cls.canAs( OntClass.class &&  !occurs.contains( cls )) {
      //list subclasses
      for (Iterator i = cls.listSubClasses( true );  i.hasNext(); ) {
        OntClass sub = (OntClass) i.next();

        // we push this expression on the occurs list before we recurse
        occurs.add( cls );
        parseClass(sub, occurs, depth+1);
        occurs.remove( cls );
View Full Code Here

  public Iterator rootClasses( OntModel m ) {
    List roots = new ArrayList();
   
    for (Iterator i = m.listClasses();  i.hasNext(); ) {
      OntClass c = (OntClass) i.next();
       
      try {
      // too confusing to list all the restrictions as root classes
        if (c.isAnon()) {
          continue;
        }
   
        if (c.hasSuperClass( m.getProfile().THING(), true ) ) {
          // this class is directly descended from Thing
          roots.add( c );
        } else if (c.getCardinality( m.getProfile().SUB_CLASS_OF() ) == 0 ) {
          // this class has no super-classes
          // (can occur if we're not using the reasoner)
          roots.add( c );
        }
      } catch (Exception e) {
View Full Code Here

        }
      } else if (resource instanceof OntClass) {
        //list equivalent classes
        for (Iterator i=((OntClass)resource).listEquivalentClasses();
          i.hasNext();) {
          OntClass equivClass = (OntClass) i.next();
          //add labels
          for (Iterator j=equivClass.listLabels(null); j.hasNext();) {
            Literal l = (Literal) j.next();
            synonyms.put(l.toString(), "1");
          }
        }
      }
View Full Code Here

    out.println();
 
    // recurse to the next level down
    if (cls.canAs( OntClass.class ) && !occurs.contains( cls )) {
      for (Iterator i = cls.listSubClasses( true ); i.hasNext(); ) {
        OntClass sub = (OntClass) i.next();

        // we push this expression on the occurs list before we recurse
        occurs.add( cls );
        renderHierarchy( out, sub, occurs, depth + 1 );
        occurs.remove( cls );
View Full Code Here

TOP

Related Classes of com.hp.hpl.jena.ontology.OntClass

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.