Examples of OntClass


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

             *
             * OBS: Restrictions sao Superclasses sem LocalName.
             */
            if(ontClass.getSuperClass() != null){
               Iterator<OntClass> it = ontClass.listSuperClasses(true);
               OntClass aux = null;
               while(it.hasNext()){
                   aux = it.next();
                   if(aux.getLocalName() != null){ //tem LocalName, referencia a classe pai
                       ConceptAxiom axioma = new ConceptAxiom();
                       axioma.setNome("subClassOf");
                       axioma.setValor(lowerFirstChar(aux.getLocalName()));
                       tmpConcept.addConceptAxiom(axioma);
                      
                       //Se a super classe for abstrata recupera todos os relacionamentos
                       List<ConceptRestriction> relacionamentosSup = recuperarRelacionamentosSup(aux, ontClass.getLocalName());
                       for(ConceptRestriction conRest : relacionamentosSup){
                         tmpConcept.addConceptRestriction(conRest);
                       }
                   }else{ //eh um restriction
                       Restriction restriction = aux.asRestriction();
                       ConceptRestriction conRest = recuperarDadosRestriction(restriction, tmpConcept.getNome());
                       tmpConcept.addConceptRestriction(conRest);
                      
//                       //Verificar se existe mais de uma classe no range do OP e criar disjoints
//                     ObjectProperty op = parser.recuperarObjectProperty(conRest.getNomeProperty());
//                     if(op.getRange().asClass().isUnionClass()){
//                       UnionClass uniao = op.getRange().asClass().asUnionClass();
//                           ExtendedIterator<? extends OntClass> iterador = uniao.listOperands();
//                           while(iterador.hasNext()){
//                               OntClass classe = (OntClass) iterador.next();
//                               if(classe.getLocalName().equals(ontClass.getLocalName()) == false){
//                                
//                                 //Criacao e adicao do conceito negativo a lista de conceitos
//                                 Concept conceitoNeg = criarConceitoNegativo(classe);
//                                   if(isConceptInList(conceitoNeg, conceptsList) == false){
//                                     conceptsList.add(conceitoNeg); 
//                                   } 
//                                  
//                                   //adiciona a referencia de disjuncao
//                                   ConceptAxiom cAxioma = new ConceptAxiom();
//                                   cAxioma.setNome("disjointWith");
//                                   cAxioma.setValor(lowerFirstChar(conceitoNeg.getNome()));
//                                  
//                                   tmpConcept.addConceptAxiom(cAxioma);
//                               }
//                           }
//                     }
                   }
               }
            }

//            /*
//             * Recupera todos os axiomas DisjointWith do conceito e cria um conceito
//             * auxiliar para permitir a negacao.
//             *
//             * Como o forte nao e capaz de revisar regras com negacao e necessario
//             * criar um novo ceonceito que possui a negacao e inclui-lo no FDT.
//             *
//             * Cria-se entao um conceitoNegacao e um axioma subclassOf relacionando
//             * a classe presente ao conceito negado, de forma que a geracao da regra
//             * cria um predicado "regraNegacao(A)".
//             */
//            if(ontClass.getDisjointWith() != null){
//                //iterador em cima de todas as classes disjuntas
//                Iterator<OntClass> it = ontClass.listDisjointWith();
//                OntClass aux = null;
//                while(it.hasNext()){
//                    aux = it.next();
//
//                    //Criacao e adicao do conceito negativo a lista de conceitos
//                    Concept conceitoNeg = criarConceitoNegativo(aux);
//                    if(isConceptInList(conceitoNeg, conceptsList) == false){
//                      conceptsList.add(conceitoNeg); 
//                    }
//                   
//                    //adiciona a referencia de disjuncao
//                    ConceptAxiom axioma = new ConceptAxiom();
//                    axioma.setNome("disjointWith");
//                    axioma.setValor(lowerFirstChar(conceitoNeg.getNome()));
//
//                    tmpConcept.addConceptAxiom(axioma);
//                }
//            }

            /*
             * Se a classe possuir o axioma EquivalentClass indicando sua
             * equivalencia a outra classe da ontologia entao ambas deverao
             * ser excluidas da revisao, sendo adicionadas ao FDT.
             *
             * Na geracao do conceito e inserido um axioma equivalentClass na lista
             * de axiomas com o valor igual ao nome do conceito ao qual se refere
             * a equivalencia. Desta forma sera possivel identificar posteriormente
             * os dois conceitos que deverao ser inseridos no FDT.
             */
            if(ontClass.getEquivalentClass() != null){
                //iterador em cima de todas as classes equivalentes
                Iterator<OntClass> it = ontClass.listEquivalentClasses();
                OntClass aux = null;
                while(it.hasNext()){
                    aux = it.next();
                    ConceptAxiom axioma = new ConceptAxiom();
                    axioma.setNome("equivalentClass");
                    axioma.setValor(lowerFirstChar(aux.getLocalName()));
                    tmpConcept.addConceptAxiom(axioma);
                }
            }

            conceptsList.add(tmpConcept);
View Full Code Here

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

        for(ObjectProperty objProp : conjObjProp){
            //Criar um Iterador em cima dos valores em RANGE
            //Caso haja mais de um, todos serao adicionados ao Relationship
            ExtendedIterator itRanges = objProp.listRange();
            while(itRanges.hasNext()){
              OntClass rangeClasses = (OntClass)itRanges.next();
                //Se houver mais de um Range
                if(rangeClasses.isAnon()){
                    Iterator itRangeClasses = rangeClasses.asUnionClass().getOperands().iterator();
                    //Adiciona cada Range ao Relationship
                    while(itRangeClasses.hasNext()){
                      Resource range =  (Resource)itRangeClasses.next();
                     
                      //Se a classe no range for abstrata recupera of filhos concretos indiretos
                      if(checkAbstractClass(retrieveOntClass(range.getLocalName()))){
                        //recupera filhos concretos indiretos
                        List<OntClass> filhosConcretos = recuperarFilhosConcretos(retrieveOntClass(range.getLocalName()));
                        for(OntClass c : filhosConcretos){
                          relationshipList.add(criaRelacionamentoAuxiliar(c.getLocalName(), objProp));
                        }
                  }else{
                    relationshipList.add(criaRelacionamentoAuxiliar(range.getLocalName(), objProp));
                  }
                    }
                //Havendo somente um Range
                }else{
                  if(checkAbstractClass(retrieveOntClass(rangeClasses.getLocalName()))){
                    //recupera filhos concretos indiretos
                    List<OntClass> filhosConcretos = recuperarFilhosConcretos(retrieveOntClass(rangeClasses.getLocalName()));
                    for(OntClass c : filhosConcretos){
                      relationshipList.add(criaRelacionamentoAuxiliar(c.getLocalName(), objProp));
                    }
                  }else{
                    relationshipList.add(criaRelacionamentoAuxiliar(rangeClasses.getLocalName(), objProp));
                  }
                }
            }
        }
        return relationshipList;
View Full Code Here

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

        //Criar um Iterador em cima dos valores em DOMAIN
        //Caso haja mais de um, todos serao adicionados ao Relationship
        ExtendedIterator itDomains = datatype.listDomain();
        List<String> termosDomain = new ArrayList<String>();
        while(itDomains.hasNext()){
            OntClass domainClasses = (OntClass)itDomains.next();
            //Se houver mais de um Range
            if(domainClasses.isAnon()){
                Iterator itDomainClasses = domainClasses.asUnionClass().getOperands().iterator();
                //Adiciona cada Range ao Relationship
                while(itDomainClasses.hasNext()){
                    Resource range =  (Resource)itDomainClasses.next();
                    termosDomain.add(lowerFirstChar(range.getLocalName()));
                }
            //Havendo somente um Range
            }else{
                termosDomain.add(lowerFirstChar(domainClasses.getLocalName()));
            }
        }

        return termosDomain;
    }
View Full Code Here

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

      List<ConceptRestriction> relacionamentos = new ArrayList<ConceptRestriction>();
     
    if(checkAbstractClass(ontClass)){
        if(ontClass.getSuperClass() != null){
                Iterator<OntClass> it = ontClass.listSuperClasses(true);
                OntClass aux = null;
                while(it.hasNext()){
                    aux = it.next();
                    if(aux.getLocalName() == null){
                      Restriction restriction = aux.asRestriction();
                        relacionamentos.add(recuperarDadosRestriction(restriction, nomeConceitoBase));
                    }else{
                      relacionamentos.addAll(recuperarRelacionamentosSup(aux, nomeConceitoBase));
                    }
                }
View Full Code Here

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

    //passa por cada classe da ontologia
    for(OntClass ontClass : conjClasses){
      //procura o axioma subClassOf da classe
      if(ontClass.getSuperClass() != null){
                Iterator<OntClass> it = ontClass.listSuperClasses(true);
                OntClass aux = null;
                //Para cada superclasse
                while(it.hasNext()){
                    aux = it.next();
                    //Se o nome for NULL nao eh referencia a superclasse
                    if(aux.getLocalName() == null){
                      continue;
                    }
                    //Verifica se eh filha da classe passada como parametro
                    if(aux.getLocalName().equalsIgnoreCase(classeBase.getLocalName())){
                      //sendo filha verifica se tambem eh abstrata
                      if(checkAbstractClass(ontClass)){
                        //sendo abstrata procura os filhos concretos novamente
                        filhosConcretos.addAll(recuperarFilhosConcretos(ontClass));
                      }else{
View Full Code Here

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

        // print validation report
        ValidityReport report = model.validate();
        printIterator( report.getReports(), "Validation Results" );
       
        // print superclasses using the utility function
        OntClass c = model.getOntClass( ns + "MaleStudentWith3Daughters" );        
        printIterator(c.listSuperClasses(), "All super classes of " + c.getLocalName());
        // OntClass provides function to print *only* the direct subclasses
        printIterator(c.listSuperClasses(true), "Direct superclasses of " + c.getLocalName());
       
        System.out.println();
    }
View Full Code Here

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

        return set;
    }

    public JTree getJTree() {
        // Use OntClass for convenience
        OntClass owlThing = model.getOntClass( OWL.Thing.getURI() );
        OntClass owlNothing = model.getOntClass( OWL.Nothing.getURI() );

        // Find all unsatisfiable concepts, i.e classes equivalent
        // to owl:Nothing
        unsatConcepts = collect( owlNothing.listEquivalentClasses() );

        // create a tree starting with owl:Thing node as the root
        DefaultMutableTreeNode thing = createTree( owlThing );

        Iterator<OntResource> i = unsatConcepts.iterator();
        if( i.hasNext() ) {
            // We want to display every unsatisfiable concept as a
            // different node in the tree
            DefaultMutableTreeNode nothing = createSingletonNode( owlNothing );
            // iterate through unsatisfiable concepts and add them to
            // the tree
            while( i.hasNext() ) {
                OntClass unsat = (OntClass) i.next();

                if( unsat.equals( owlNothing ) )
                    continue;
               
                DefaultMutableTreeNode node = createSingletonNode( unsat );
                nothing.add( node );
            }
View Full Code Here

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

        Set processedSubs = new HashSet();
       
        // get only direct subclasses
        Iterator subs = cls.listSubClasses( true );
        while( subs.hasNext() ) {
            OntClass sub = (OntClass) subs.next();
           
            if( sub.isAnon() )
                continue;

            if( processedSubs.contains( sub ) )
                continue;
           
View Full Code Here

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

    // load the model to the reasoner
    model.prepare();
   
    // create property and resources to query the reasoner
    OntClass Person = model.getOntClass("http://xmlns.com/foaf/0.1/Person");
    Property workHomepage = model.getProperty("http://xmlns.com/foaf/0.1/workInfoHomepage");
    Property foafName = model.getProperty("http://xmlns.com/foaf/0.1/name");
   
    // get all instances of Person class
    Iterator<?> i = Person.listInstances();
    while( i.hasNext() ) {
        Individual ind = (Individual) i.next();
       
        // get the info about this specific individual
        String name = ((Literal) ind.getPropertyValue( foafName )).getString();
View Full Code Here

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

        // print validation report
        ValidityReport report = model.validate();
        printIterator( report.getReports(), "Validation Results" );
       
        // print superclasses using the utility function
        OntClass c = model.getOntClass( ns + "MaleStudentWith3Daughters" );        
        printIterator(c.listSuperClasses(), "All super classes of " + c.getLocalName());
        // OntClass provides function to print *only* the direct subclasses
        printIterator(c.listSuperClasses(true), "Direct superclasses of " + c.getLocalName());
       
        System.out.println();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.