All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.clarkparsia.pellint.format.SimpleLintFormat Maven / Gradle / Ivy

// Copyright (c) 2006 - 2008, Clark & Parsia, LLC. 
// This source code is available under the terms of the Affero General Public License v3.
//
// Please see LICENSE.txt for full license terms, including the availability of proprietary exceptions.
// Questions, comments, or requests for clarification: [email protected]

package com.clarkparsia.pellint.format;

import java.util.Iterator;
import java.util.Set;

import org.semanticweb.owlapi.model.OWLClass;
import org.semanticweb.owlapi.model.OWLClassAxiom;

import com.clarkparsia.pellint.model.Lint;
import com.clarkparsia.pellint.model.Severity;

/**
 * 

* Title: Simple Lint Format *

*

* Description: The default Lint Format that tries to print a short but informative content for a Lint. *

*

* Copyright: Copyright (c) 2008 *

*

* Company: Clark & Parsia, LLC. *

* * @author Harris Lin */ public class SimpleLintFormat implements LintFormat { private static final int CLASSES_LIMIT = 6; public String format(Lint lint) { Set participatingClasses = lint.getParticipatingClasses(); Set participatingAxioms = lint.getParticipatingAxioms(); if ((participatingClasses == null || participatingClasses.isEmpty()) && (participatingAxioms == null || participatingAxioms.isEmpty())) { return ""; } Severity severity = lint.getSeverity(); StringBuilder strBuilder = new StringBuilder(); strBuilder.append(" - "); if (severity != null) { strBuilder.append(severity).append(' '); } if (participatingClasses != null && !participatingClasses.isEmpty()) { int i = 0; for (Iterator it = participatingClasses.iterator(); it.hasNext() && i < CLASSES_LIMIT; i++) { OWLClass participatingClass = it.next(); strBuilder.append(participatingClass).append(' '); } if (participatingClasses.size() > CLASSES_LIMIT) { strBuilder.append("... and "); strBuilder.append(participatingClasses.size() - CLASSES_LIMIT); strBuilder.append(" more."); } strBuilder.append('\n'); } else if (participatingAxioms != null && !participatingAxioms.isEmpty()) { for (OWLClassAxiom axiom : participatingAxioms) { strBuilder.append(axiom).append('\n'); } } return strBuilder.toString(); } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy