Package org.semanticweb.owl.model

Examples of org.semanticweb.owl.model.OWLOntologyManager


     * @param dataFactory The data factory that the manager should have a reference to.
     * @return The manager.
     */
    public static OWLOntologyManager createOWLOntologyManager(OWLDataFactory dataFactory) {
        // Create the ontology manager and add ontology factories, mappers and storers
        OWLOntologyManager ontologyManager = new OWLOntologyManagerImpl(dataFactory);
        ontologyManager.addOntologyStorer(new RDFXMLOntologyStorer());
        ontologyManager.addOntologyStorer(new OWLXMLOntologyStorer());
        ontologyManager.addOntologyStorer(new OWLFunctionalSyntaxOntologyStorer());
        ontologyManager.addOntologyStorer(new ManchesterOWLSyntaxOntologyStorer());
        ontologyManager.addOntologyStorer(new OBOFlatFileOntologyStorer());
        ontologyManager.addOntologyStorer(new KRSS2OWLSyntaxOntologyStorer());
        ontologyManager.addOntologyStorer(new TurtleOntologyStorer());
        ontologyManager.addOntologyStorer(new LatexOntologyStorer());

        ontologyManager.addURIMapper(new NonMappingOntologyURIMapper());

        ontologyManager.addOntologyFactory(new EmptyInMemOWLOntologyFactory());
        ontologyManager.addOntologyFactory(new ParsableOWLOntologyFactory());

        return ontologyManager;
    }
View Full Code Here


   
    /* Contains the elements of each selection step */
    this.selectionList = new HashSet<OWLEntity>();
   
    // Compute the ordered list of classes
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
   
    OWLOntology tbox = null;
    try {
      tbox = manager.loadOntology(tboxURI);
     
      // Compute the number of direct subclasses of each class
      for (OWLClass owlClass : this.classes){
        Set<OWLDescription> subClasses = owlClass.getSubClasses(tbox);
        this.sortedList.add(new OWLSubclass(owlClass,subClasses.size()));
      }
     
      manager.removeOntology(tboxURI);
    } catch (OWLOntologyCreationException e) {
      e.printStackTrace();
      // Provide a default order
      for (OWLClass owlClass : this.classes){
        this.sortedList.add(new OWLSubclass(owlClass,0));
View Full Code Here

   
    /* Contains the elements of each selection step */
    this.selectionList = new HashSet<OWLEntity>();
   
    // Compute the ordered list of classes
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLOntology tbox = null;
   
    try {
      tbox = manager.loadOntology(tboxURI);
     
      // Compute the number of direct subclasses of each class
      for (OWLClass owlClass : this.classes){
        Set<OWLDescription> subClasses = owlClass.getSubClasses(tbox);
        this.sortedList.add(new OWLSubclass(owlClass,subClasses.size()));
      }
     
      manager.removeOntology(tboxURI);
    } catch (OWLOntologyCreationException e) {
      e.printStackTrace();
      // Provide a default order
      for (OWLClass owlClass : this.classes){
        this.sortedList.add(new OWLSubclass(owlClass,0));
View Full Code Here

  }

  @Test
  public void testAxiomConverterRules3() {
    KnowledgeBase kb = new KnowledgeBase();
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLDataFactory df = manager.getOWLDataFactory();
    AxiomConverter converter = new AxiomConverter( kb, df );

    ATermAppl p = ATermUtils.makeTermAppl( "p" );
    ATermAppl q = ATermUtils.makeTermAppl( "q" );
    ATermAppl x = ATermUtils.makeVar( "x" );
View Full Code Here

    return ontology;
  }

  public void writePretty(OutputStream out, RDFModel model) throws IOException {
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLOntology ontology = null;
    try {
      ontology = convert( model, manager );
    } catch( OWLOntologyCreationException e ) {
      throw new RuntimeException( e );
    } catch( SAXException e ) {
      throw new RuntimeException( e );
    }

    try {
      manager.saveOntology( ontology, new StreamOutputTarget( out ) );
    } catch( UnknownOWLOntologyException e ) {
      throw new RuntimeException( e );
    } catch( OWLOntologyStorageException e ) {
      throw new IOException( e.getMessage() );
    }
View Full Code Here

      assertTrue(premise.contains(s));
    }
  }

  private void testOWLAPI(String premiseURI, String conclusionURI) {
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    Reasoner reasoner = new Reasoner(manager);
   
    try {
      OWLOntology premise = manager.loadOntology(URI.create(premiseURI));
      OWLOntology conclusion = manager.loadOntology(URI
          .create(conclusionURI));

      reasoner.loadOntology(premise);
     
      assertTrue(reasoner.isEntailed(conclusion));
View Full Code Here

    assertFalse( kb.isClass( n ) );
  }

  @Test
  public void testIsClass5() throws OWLException {
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLDataFactory factory = manager.getOWLDataFactory();
    OWLOntology ontology = manager.createOntology(URI
        .create("http://example.org"));
   
    OWLDataRange dataRange = factory.getOWLDataType(XSDVocabulary.INTEGER
        .getURI());
    OWLDataRangeFacetRestriction dataRangeFacetRestriction = factory
        .getOWLDataRangeFacetRestriction(
            OWLRestrictedDataRangeFacetVocabulary.MIN_EXCLUSIVE, 1);
    OWLDataRangeRestriction dataRangeRestriction = factory
        .getOWLDataRangeRestriction(dataRange,
            dataRangeFacetRestriction);

    OWLDataProperty p = factory.getOWLDataProperty(URI
        .create("http://example#p"));
    OWLDataSomeRestriction dataSomeRestriction = factory
        .getOWLDataSomeRestriction(p, dataRangeRestriction);

    OWLClass c = factory.getOWLClass(URI.create("http://example#c"));

    OWLSubClassAxiom sc = factory.getOWLSubClassAxiom(c,
        dataSomeRestriction);

    manager.addAxiom(ontology, sc);
   
    Reasoner reasoner = new Reasoner(manager);

    reasoner.loadOntology(ontology);
    assertTrue(reasoner.isConsistent());
View Full Code Here

TOP

Related Classes of org.semanticweb.owl.model.OWLOntologyManager

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.