Package org.semanticweb.owl.model

Examples of org.semanticweb.owl.model.OWLDataFactory


  private static boolean populate(URI uri, int instances, URI outputFile){
    OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
    OWLOntology ontology = loadOntology(manager, uri);
    if (ontology != null){
      try {
        OWLDataFactory factory = manager.getOWLDataFactory();
        VocabularyManager vManager = new VocabularyManager(ontology);
        List<OWLClass> classes = new Vector<OWLClass>(vManager.getConceptSet());
       
        List<OWLAxiomChange> toAdd = new Vector<OWLAxiomChange>();
        for (int i = 0; i < instances; i++) {
          int rnd = m_random.nextInt(classes.size());
          OWLClassAssertionAxiom newAxiom = factory.getOWLClassAssertionAxiom(newIndividual(factory), classes.get(rnd));
          toAdd.add(new AddAxiom(ontology,newAxiom))
          System.out.println((i+1)+"- new axiom: "+newAxiom.toString());
        }       
        manager.applyChanges(toAdd);
        OutputStreamWriter sw = new FileWriter(new File(outputFile));
View Full Code Here


          if (isInterruptible)
          {

            List<OWLOntologyChange> changesToMake = new Vector<OWLOntologyChange>();
            OWLDataFactory factory = manager.getOWLDataFactory();
            timers.createTimer("aboxupdate");
            Timer timerAboxUpdate = timers.startTimer("aboxupdate");
            for (OWLIndividual ci : individuals)
            {
              changesToMake.add(new AddAxiom(aboxOntology,
                  factory.getOWLClassAssertionAxiom(ci, cc)));
            }
            timerAboxUpdate.stop();
            aboxUpdateTime += timerAboxUpdate.getTotal();
          }
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

  public void visit(OWLSubClassAxiom axiom) {
    isEntailed = reasoner.isSubClassOf( axiom.getSubClass(), axiom.getSuperClass() );
  }

  public void visit(OWLNegativeObjectPropertyAssertionAxiom axiom) {
    OWLDataFactory factory = reasoner.getManager().getOWLDataFactory();
    OWLDescription hasValue = factory.getOWLObjectValueRestriction( axiom.getProperty(), axiom.getObject() );
    OWLDescription doesNotHaveValue = factory.getOWLObjectComplementOf( hasValue );
    isEntailed = reasoner.hasType( axiom.getSubject(), doesNotHaveValue );
  }
View Full Code Here

      }
    }
  }

  public void visit(OWLNegativeDataPropertyAssertionAxiom axiom) {
    OWLDataFactory factory = reasoner.getManager().getOWLDataFactory();
    OWLDescription hasValue = factory.getOWLDataValueRestriction( axiom.getProperty(), axiom.getObject() );
    OWLDescription doesNotHaveValue = factory.getOWLObjectComplementOf( hasValue );
    isEntailed = reasoner.hasType( axiom.getSubject(), doesNotHaveValue );
  }
View Full Code Here

  }

  @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);
View Full Code Here

TOP

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

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.