com.clarkparsia.pellint.rdfxml.RDFLints Maven / Gradle / Ivy
The newest version!
// 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.rdfxml;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.clarkparsia.pellint.util.CollectionUtil;
import com.hp.hpl.jena.rdf.model.Statement;
/**
*
* Title:
*
*
* Description:
*
*
* Copyright: Copyright (c) 2008
*
*
* Company: Clark & Parsia, LLC.
*
*
* @author Harris Lin
*/
public class RDFLints {
private Map> m_Report;
private List m_MissingStatements;
public RDFLints() {
m_Report = new LinkedHashMap>();
m_MissingStatements = CollectionUtil.makeList();
}
public void add(String category, List msgs) {
if (!msgs.isEmpty()) {
m_Report.put(category, msgs);
}
}
public void addMissingStatements(List stmts) {
m_MissingStatements.addAll(stmts);
}
public List getMissingStatements() {
return m_MissingStatements;
}
public boolean isEmpty() {
return m_Report.isEmpty();
}
public String toString() {
if (m_Report.isEmpty()) {
return "No RDF lints found.";
}
StringBuilder builder = new StringBuilder();
for (Entry> entry : m_Report.entrySet()) {
String category = entry.getKey();
List msgs = entry.getValue();
if (!msgs.isEmpty()) {
builder.append("[")
.append(category)
.append("]\n");
for (String msg : msgs) {
builder.append("- ")
.append(msg)
.append("\n");
}
builder.append("\n");
}
}
return builder.toString();
}
}