Package org.mindswap.pellet.jena

Examples of org.mindswap.pellet.jena.ModelExtractor


  private void extractInferences() {
    if( selector.size() == 0 )
      throw new PelletCmdException( "Selector is empty, provide types to extract" );

    ModelExtractor extractor = new ModelExtractor( getKB() );
    extractor.setSelector( selector );

    Model extracted = ModelFactory.createDefaultModel();
   
    if( SetUtils.intersects( selector, ModelExtractor.StatementType.ALL_CLASS_STATEMENTS ) ) {
      startTask( "Extracting class statements" );
      extractor.extractClassModel( extracted );
      finishTask( "Extracting class statements" );
    }

    if( SetUtils.intersects( selector, ModelExtractor.StatementType.ALL_PROPERTY_STATEMENTS ) ) {
      startTask( "Extracting property statements" );
      extractor.extractPropertyModel( extracted );
      finishTask( "Extracting property statements" );
    }

    if( SetUtils.intersects( selector, ModelExtractor.StatementType.ALL_INDIVIDUAL_STATEMENTS ) ) {
      startTask( "Extracting individual statements" );
      extractor.extractIndividualModel( extracted );
      finishTask( "Extracting individual statements" );
    }

    output( extracted );
  }
View Full Code Here


          return true;
        }
       
        @Override
        public ExtendedIterator<Triple> find(KnowledgeBase kb, PelletInfGraph pellet, Node s, Node p, Node o) {
          ModelExtractor me = new ModelExtractor( kb );
          me.setSelector( StatementType.ALL_STATEMENTS );
          Graph graph = me.extractModel().getGraph();
          return graph.find( Triple.ANY );
        }
      }
    );       
   
View Full Code Here

    rawModel.add(a, RDF.type, C);
    rawModel.add(C, RDFS.subClassOf, D);
   
    OntModel model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC, rawModel );

    ModelExtractor extractor = new ModelExtractor(model);
    Model inferences = extractor.extractModel();
   
    assertTrue(inferences.contains(a, RDF.type, D));
  }
View Full Code Here

          return true;
        }
       
        @Override
        public ExtendedIterator<Triple> find(KnowledgeBase kb, GraphLoader loader, Node s, Node p, Node o) {
          ModelExtractor me = new ModelExtractor( kb );
          me.setSelector( StatementType.ALL_STATEMENTS );
          Graph graph = me.extractModel().getGraph();
          return graph.find( Triple.ANY );
        }
      }
    );       
   
View Full Code Here

    rawModel.add(a, RDF.type, C);
    rawModel.add(C, RDFS.subClassOf, D);
   
    OntModel model = ModelFactory.createOntologyModel( PelletReasonerFactory.THE_SPEC, rawModel );

    ModelExtractor extractor = new ModelExtractor(model);
    Model inferences = extractor.extractModel();
   
    assertTrue(inferences.contains(a, RDF.type, D));
  }
View Full Code Here

TOP

Related Classes of org.mindswap.pellet.jena.ModelExtractor

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.