Package org.semanticweb.owlapi.model

Examples of org.semanticweb.owlapi.model.OWLEntity


                sb.append(formatClassExpression(ces.get(i), ont));
            }
            return sb.toString();
        } else if (a instanceof OWLDeclarationAxiom) {
            OWLDeclarationAxiom da = (OWLDeclarationAxiom) a;
            OWLEntity ent = da.getEntity();
            String name = (ent.isOWLClass()) ? getLabel(ent.asOWLClass(), ont)
                    : ent.toString();
            return "init(" + name + ")";
        } else {
            return a.toString();
        }
    }
View Full Code Here


                sb.append(formatClassExpression(ces.get(i), ont));
            }
            return sb.toString();
        } else if (a instanceof OWLDeclarationAxiom) {
            OWLDeclarationAxiom da = (OWLDeclarationAxiom) a;
            OWLEntity ent = da.getEntity();
            String name = (ent.isOWLClass()) ? getLabel(ent.asOWLClass(), ont)
                    : ent.toString();
            return "init(" + name + ")";
        } else {
            return a.toString();
        }
    }
View Full Code Here

        // if we have never seen this entity extract its module
        if( !modules.containsKey( member ) ) {

          Set<OWLEntity> memberMod = new HashSet<OWLEntity>();
          List<OWLEntity> memberCycle = new ArrayList<OWLEntity>();
          OWLEntity root = extractModuleSignature( member, stackElements, memberCycle,
              memberMod );

          module.addAll( memberMod );

          // Option 1: No cycle was identified, extraction successful
          if( root.equals( member ) ) {
            assert !stackElements.contains( member ) : "Recursive call did not cleanup stack";
          }
          // Option 2: entity is in a cycle
          else {
            myCycle.addAll( memberCycle );
View Full Code Here

          assert stack.contains( member ) : "node was supposed to be on the stack";
          // all the entities in the stack up until that node
          // will end up having the same module
          boolean foundMember = false;
          for( int i = stack.size() - 1; !foundMember; i-- ) {
            OWLEntity next = stack.get( i );
            modEqCls.union( member, next );
            foundMember = next.equals( member );
          }
        }
        else {
          // simply retrieve and copy the precomputed module
          module.addAll( modules.get( member ) );
View Full Code Here

    if( visited.contains( node ) )
      return;
    else
      visited.add( node );

    OWLEntity entity = node.getName();

    // get the sig for this module
    Set<OWLEntity> signature = modules.get( entity );

    boolean outdated = false;
View Full Code Here

   */
  public static void saveModules( MultiValueMap<OWLEntity, OWLEntity> modules, OutputStream outputStream ) throws IOException {
    PrintWriter pw = new PrintWriter( outputStream );
   
    for ( Entry<OWLEntity, Set<OWLEntity>> entry : modules.entrySet() ) {
      OWLEntity entity = entry.getKey();
      Set<OWLEntity> module = entry.getValue();
     
      pw.println( getModuleBegin( entity ) );
 
      for( OWLEntity member :  module ) {
View Full Code Here

   
    if ( !line.startsWith( MODULE_BEGIN_KEYWORD )) {
      throw new IOException( "Invalid information in the module file (line " + lnr.getLineNumber() + "). "  + MODULE_BEGIN_KEYWORD + " expected." );
    }
   
    OWLEntity module = readModuleInformation( line.trim() );
   
    boolean endOfModuleReached = false;
    Set<OWLEntity> members = new HashSet<OWLEntity>();
   
    while( ( line = lnr.readLine() ) != null ) {
View Full Code Here

   * @param ontologies
   *            ontologies we are searching
   * @return an entity referenced in the given ontology that has the given URI
   *         or local name   */
  public static OWLEntity findEntity(String name, Set<OWLOntology> ontologies) {
    OWLEntity entity = null;
    for( OWLOntology ontology : ontologies ) {
      if( (entity = findEntity( name, ontology )) != null )
        break;
    }
    return entity;
View Full Code Here

   *            ontology we are searching
   * @return an entity referenced in the given ontology that has the given URI
   *         or local name
   */
  public static OWLEntity findEntity(String name, OWLOntology ontology) {
    OWLEntity entity = null;

    if( name.equals( "owl:Thing" ) )
      entity = OWL.Thing;
    else if( name.equals( "owl:Nothing" ) )
      entity = OWL.Nothing;
View Full Code Here

   
  private void testProperty( String ontologyURI, String propertyURI ) {
    OWLAPILoader loader = new OWLAPILoader();
    KnowledgeBase kb = loader.createKB( new String[] { ontologyURI } );
   
    OWLEntity entity = OntologyUtils.findEntity( propertyURI, loader.getAllOntologies() );

    if( entity == null )
      throw new IllegalArgumentException( "Property not found: " + propertyURI );

    if( !(entity instanceof OWLObjectProperty) )
      throw new IllegalArgumentException( "Not an object property: " + propertyURI );

    if( !((OWLObjectProperty) entity).isTransitive( loader.getAllOntologies() ) )
      throw new IllegalArgumentException( "Not a transitive property: " + propertyURI );
   
    ATermAppl p = ATermUtils.makeTermAppl( entity.getIRI().toString() );

    POTaxonomyBuilder builder = null;

    // Parts for individuals
    //builder = new POTaxonomyBuilder( kb, new PartIndividualsComparator( kb, p ) );
View Full Code Here

TOP

Related Classes of org.semanticweb.owlapi.model.OWLEntity

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.