Package com.clarkparsia.pellint.model

Examples of com.clarkparsia.pellint.model.OntologyLints


    m_OutputOntologyPath = v;
  }

  public static OntologyLints lint(List<AxiomLintPattern> axiomLintPatterns,
      List<OntologyLintPattern> ontologyLintPatterns, OWLOntology ontology) {
    OntologyLints ontologyLints = new OntologyLints( ontology );
    for( OWLAxiom axiom : ontology.getAxioms() ) {
      for( AxiomLintPattern pattern : axiomLintPatterns ) {
        Lint lint = pattern.match( ontology, axiom );
        if( lint != null ) {
          ontologyLints.addLint( pattern, lint );
        }
      }
    }

    for( OntologyLintPattern pattern : ontologyLintPatterns ) {
      List<Lint> lints = pattern.match( ontology );
      if( !lints.isEmpty() ) {
        ontologyLints.addLints( pattern, lints );
      }
    }

    ontologyLints.sort( new Comparator<Lint>() {
      public int compare(Lint lint0, Lint lint1) {
        Severity severity0 = lint0.getSeverity();
        Severity severity1 = lint1.getSeverity();
        if( severity0 != null && severity1 != null ) {
          return -severity0.compareTo( severity1 );
View Full Code Here


      throw new PelletCmdException( e );
    }
   
    output( getOWL2DLProfileViolations( rootOntology ) );
   
    OntologyLints rootOntologyLints = lint( axiomLintPatterns, ontologyLintPatterns,
        rootOntology );
    output( rootOntologyLints.toString() );

    if( !m_DoRootOnly ) {
      Set<OWLOntology> importClosures = CollectionUtil.copy( manager
          .getImportsClosure( rootOntology ) );
      importClosures.remove( rootOntology );

      if( importClosures.isEmpty() ) {
        output( "\n" + rootOntology.getOntologyID() + " does not import other ontologies." );
      }
      else {
        for( OWLOntology importedOntology : importClosures ) {
          output( getOWL2DLProfileViolations( importedOntology ) );
         
          OntologyLints importedOntologyLints = lint( axiomLintPatterns,
              ontologyLintPatterns, importedOntology );
          output( importedOntologyLints.toString() );
        }

        OWLOntology mergedImportClosure = buildMergedImportClosure( manager, rootOntology );
        OntologyLints mergedOntologyLints = lint( axiomLintPatterns, ontologyLintPatterns,
            mergedImportClosure );
        mergedOntologyLints.setRootOntology( rootOntology );
        output( mergedOntologyLints.toString() );
      }
    }
   
   
    if( m_OutputOntologyPath != null ) {
View Full Code Here

*/
public class OntologyLintsTest extends PellintTestCase {

  @Test
  public void testSize() {
    OntologyLints ontologyLints = new OntologyLints(m_Ontology);
    assertSame(m_Ontology, ontologyLints.getOntology());
    assertTrue(ontologyLints.isEmpty());
    assertEquals(0, ontologyLints.size());
   
    MockLint lint = new MockLint();
    MockLintPattern pattern1 = new MockLintPattern(false);
    ontologyLints.addLint(pattern1, lint);
    assertFalse(ontologyLints.isEmpty());
    assertEquals(1, ontologyLints.size());
   
    MockLintPattern pattern2 = new MockLintPattern(true);
    List<Lint> lints = Arrays.<Lint>asList(new MockLint(), new MockLint(), new MockLint());
    ontologyLints.addLints(pattern2, lints);
    assertFalse(ontologyLints.isEmpty());
    assertEquals(1 + lints.size(), ontologyLints.size());
  }
View Full Code Here

    assertEquals(1 + lints.size(), ontologyLints.size());
  }

  @Test
  public void testApplyFix() throws OWLOntologyChangeException {
    OntologyLints ontologyLints = new OntologyLints(m_Ontology);
   
    MockLint unfixableLint = new MockLint();
    MockLintPattern unfixablePattern = new MockLintPattern(false);
    ontologyLints.addLint(unfixablePattern, unfixableLint);
    MockLintPattern fixablePattern = new MockLintPattern(true);
    List<Lint> lints = Arrays.<Lint>asList(new MockLint(), new MockLint(), new MockLint());
    ontologyLints.addLints(fixablePattern, lints);
   
    assertEquals(Collections.singleton( unfixableLint ), ontologyLints.applyFix(m_Manager));
  }
View Full Code Here

    m_OutputOntologyPath = v;
  }

  public static OntologyLints lint(List<AxiomLintPattern> axiomLintPatterns,
      List<OntologyLintPattern> ontologyLintPatterns, OWLOntology ontology) {
    OntologyLints ontologyLints = new OntologyLints( ontology );
    for( OWLAxiom axiom : ontology.getAxioms() ) {
      for( AxiomLintPattern pattern : axiomLintPatterns ) {
        Lint lint = pattern.match( ontology, axiom );
        if( lint != null ) {
          ontologyLints.addLint( pattern, lint );
        }
      }
    }

    for( OntologyLintPattern pattern : ontologyLintPatterns ) {
      List<Lint> lints = pattern.match( ontology );
      if( !lints.isEmpty() ) {
        ontologyLints.addLints( pattern, lints );
      }
    }

    ontologyLints.sort( new Comparator<Lint>() {
      public int compare(Lint lint0, Lint lint1) {
        Severity severity0 = lint0.getSeverity();
        Severity severity1 = lint1.getSeverity();
        if( severity0 != null && severity1 != null ) {
          return -severity0.compareTo( severity1 );
View Full Code Here

      throw new PelletCmdException( e );
    }
   
    output( getOWL2DLProfileViolations( rootOntology ) );
   
    OntologyLints rootOntologyLints = lint( axiomLintPatterns, ontologyLintPatterns,
        rootOntology );
    output( rootOntologyLints.toString() );

    if( !m_DoRootOnly ) {
      Set<OWLOntology> importClosures = CollectionUtil.copy( manager
          .getImportsClosure( rootOntology ) );
      importClosures.remove( rootOntology );

      if( importClosures.isEmpty() ) {
        output( "\n" + rootOntology.getOntologyID() + " does not import other ontologies." );
      }
      else {
        for( OWLOntology importedOntology : importClosures ) {
          output( getOWL2DLProfileViolations( importedOntology ) );
         
          OntologyLints importedOntologyLints = lint( axiomLintPatterns,
              ontologyLintPatterns, importedOntology );
          output( importedOntologyLints.toString() );
        }

        OWLOntology mergedImportClosure = buildMergedImportClosure( manager, rootOntology );
        OntologyLints mergedOntologyLints = lint( axiomLintPatterns, ontologyLintPatterns,
            mergedImportClosure );
        mergedOntologyLints.setRootOntology( rootOntology );
        output( mergedOntologyLints.toString() );
      }
    }
   
   
    if( m_OutputOntologyPath != null ) {
View Full Code Here

*/
public class OntologyLintsTest extends PellintTestCase {

  @Test
  public void testSize() {
    OntologyLints ontologyLints = new OntologyLints(m_Ontology);
    assertSame(m_Ontology, ontologyLints.getOntology());
    assertTrue(ontologyLints.isEmpty());
    assertEquals(0, ontologyLints.size());
   
    MockLint lint = new MockLint();
    MockLintPattern pattern1 = new MockLintPattern(false);
    ontologyLints.addLint(pattern1, lint);
    assertFalse(ontologyLints.isEmpty());
    assertEquals(1, ontologyLints.size());
   
    MockLintPattern pattern2 = new MockLintPattern(true);
    List<Lint> lints = Arrays.<Lint>asList(new MockLint(), new MockLint(), new MockLint());
    ontologyLints.addLints(pattern2, lints);
    assertFalse(ontologyLints.isEmpty());
    assertEquals(1 + lints.size(), ontologyLints.size());
  }
View Full Code Here

    assertEquals(1 + lints.size(), ontologyLints.size());
  }

  @Test
  public void testApplyFix() {
    OntologyLints ontologyLints = new OntologyLints(m_Ontology);
   
    MockLint unfixableLint = new MockLint();
    MockLintPattern unfixablePattern = new MockLintPattern(false);
    ontologyLints.addLint(unfixablePattern, unfixableLint);
    MockLintPattern fixablePattern = new MockLintPattern(true);
    List<Lint> lints = Arrays.<Lint>asList(new MockLint(), new MockLint(), new MockLint());
    ontologyLints.addLints(fixablePattern, lints);
   
    assertEquals(Collections.singleton( unfixableLint ), ontologyLints.applyFix(m_Manager));
  }
View Full Code Here

TOP

Related Classes of com.clarkparsia.pellint.model.OntologyLints

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.