Skip to content

Commit

Permalink
compile clean again
Browse files Browse the repository at this point in the history
  • Loading branch information
cmader committed Jun 24, 2017
1 parent 692351b commit 83f04bf
Show file tree
Hide file tree
Showing 28 changed files with 166 additions and 119 deletions.
16 changes: 8 additions & 8 deletions src/main/java/at/ac/univie/mminf/qskos4j/QSkos.java
Expand Up @@ -19,7 +19,7 @@
import at.ac.univie.mminf.qskos4j.issues.language.OmittedOrInvalidLanguageTags;
import at.ac.univie.mminf.qskos4j.issues.language.util.LanguageCoverage;
import at.ac.univie.mminf.qskos4j.issues.outlinks.BrokenLinks;
import at.ac.univie.mminf.qskos4j.issues.outlinks.HttpIRIs;
import at.ac.univie.mminf.qskos4j.issues.outlinks.HttpURIs;
import at.ac.univie.mminf.qskos4j.issues.outlinks.HttpUriSchemeViolations;
import at.ac.univie.mminf.qskos4j.issues.outlinks.MissingOutLinks;
import at.ac.univie.mminf.qskos4j.issues.relations.ReflexivelyRelatedConcepts;
Expand Down Expand Up @@ -64,7 +64,7 @@ public class QSkos {
private AuthoritativeConcepts authoritativeConcepts;
private MissingInLinks missingInLinks;
private ConceptSchemes conceptSchemes;
private HttpIRIs httpIRIs;
private HttpURIs httpURIs;

private List<Issue> registeredIssues = new ArrayList<Issue>();

Expand All @@ -88,9 +88,9 @@ public QSkos() {
private void addStatisticalIssues() {
involvedConcepts = new InvolvedConcepts();
authoritativeConcepts = new AuthoritativeConcepts(involvedConcepts);
authoritativeConcepts.setBaseIRI(baseIRI);
authoritativeConcepts.setBaseURI(baseIRI);
conceptSchemes = new ConceptSchemes();
httpIRIs = new HttpIRIs();
httpURIs = new HttpURIs();
languageCoverage = new LanguageCoverage(involvedConcepts);

registeredIssues.add(involvedConcepts);
Expand All @@ -100,7 +100,7 @@ private void addStatisticalIssues() {
registeredIssues.add(new AggregationRelations());
registeredIssues.add(conceptSchemes);
registeredIssues.add(new at.ac.univie.mminf.qskos4j.issues.count.Collections());
registeredIssues.add(httpIRIs);
registeredIssues.add(httpURIs);
}

private void addAnalyticalIssues() {
Expand Down Expand Up @@ -142,7 +142,7 @@ private void addSkosIntegrityIssues() {
}

private void addSlowIssues() {
brokenLinks = new BrokenLinks(httpIRIs);
brokenLinks = new BrokenLinks(httpURIs);
brokenLinks.setExtAccessDelayMillis(EXT_ACCESS_MILLIS);
registeredIssues.add(brokenLinks);

Expand Down Expand Up @@ -172,7 +172,7 @@ public Collection<Issue> getIssues(String commaSeparatedIssueIDs)

private Issue findIssue(String issueId) {
for (Issue issue : registeredIssues) {
if (issue.getId().equalsIgnoreCase(issueId)) {
if (issue.getIssueDescriptor().getId().equalsIgnoreCase(issueId)) {
return issue;
}
}
Expand All @@ -184,7 +184,7 @@ private String generateSupportedIssueIdList() {
String supportedIssueIds = "";
Iterator<Issue> allIssuesIt = getAllIssues().iterator();
while (allIssuesIt.hasNext()) {
supportedIssueIds += allIssuesIt.next().getId() + (allIssuesIt.hasNext() ? ", " : "");
supportedIssueIds += allIssuesIt.next().getIssueDescriptor().getId() + (allIssuesIt.hasNext() ? ", " : "");
}
return supportedIssueIds;
}
Expand Down
26 changes: 14 additions & 12 deletions src/main/java/at/ac/univie/mminf/qskos4j/cmd/ReportCollector.java
Expand Up @@ -2,6 +2,7 @@

import at.ac.univie.mminf.qskos4j.issues.Issue;
import at.ac.univie.mminf.qskos4j.result.Result;
import at.ac.univie.mminf.qskos4j.util.IssueDescriptor;
import org.eclipse.rdf4j.OpenRDFException;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.model.Statement;
Expand All @@ -22,6 +23,7 @@
import org.slf4j.LoggerFactory;

import java.io.*;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
Expand Down Expand Up @@ -110,7 +112,7 @@ private void processIssues() throws RDF4JException {
Issue issue = issueIt.next();
issueNumber++;

logger.info("Processing issue " + issueNumber + " of " + issues.size() + " (" + issue.getName() + ")");
logger.info("Processing issue " + issueNumber + " of " + issues.size() + " (" + issue.getIssueDescriptor().getName() + ")");
issue.getResult();

}
Expand All @@ -123,7 +125,7 @@ private String createReportSummary() throws IOException, RDF4JException {
summary.append("* Summary of Quality Issue Occurrences:\n");

for (Issue issue : issues) {
summary.append(issue.getName() + ": " + prepareOccurrenceText(issue) + "\n");
summary.append(issue.getIssueDescriptor().getName() + ": " + prepareOccurrenceText(issue) + "\n");
}

summary.append("\n");
Expand Down Expand Up @@ -200,7 +202,7 @@ private void writeDQVReport(Issue issue, RepositoryConnection repCon, ValueFacto
IRI pisMeasurementOf = f.createIRI(ndqv+"isMeasurementOf");

String datasetName= this.computedOn.substring(this.computedOn.lastIndexOf("/")+1, this.computedOn.length());
IRI measure= f.createIRI(nex+datasetName+issue.getName().replace(" ", "")+sdate);
IRI measure= f.createIRI(nex+datasetName+issue.getIssueDescriptor().getName().replace(" ", "")+sdate);
repCon.add(measure, ptype, f.createIRI(ndqv+"QualityMeasurement"));

if (this.computedOn.startsWith("http://")) repCon.add(measure, pcomputedOn,f.createIRI(this.computedOn));
Expand Down Expand Up @@ -229,18 +231,18 @@ private void writeDQVReport(Issue issue, RepositoryConnection repCon, ValueFacto
}
repCon.add(measure, pvalue, lval);

IRI uriDimension= f.createIRI(nex+"numOf"+issue.getName().replace(" ", ""));
repCon.add(measure, pisMeasurementOf, uriDimension); //issue.getWeblink()
IRI uriDimension= f.createIRI(nex+"numOf"+issue.getIssueDescriptor().getName().replace(" ", ""));
repCon.add(measure, pisMeasurementOf, uriDimension);

}

private String createIssueHeader(Issue issue) {
String header = "--- " +issue.getName();
IRI weblink = issue.getWeblink();
header += "\nDescription: " +issue.getDescription();
private String createIssueHeader(IssueDescriptor issueDescriptor) {
String header = "--- " +issueDescriptor.getName();
URL weblink = issueDescriptor.getWeblink();
header += "\nDescription: " +issueDescriptor.getDescription();

if (weblink != null) {
header += "\nDetailed information: " +weblink.stringValue();
header += "\nDetailed information: " +weblink.toString();
}
return header;
}
Expand All @@ -251,7 +253,7 @@ private String getDotFilesPath(File reportFile) {
}

private void writeGraphFiles(Issue issue, String dotFilesPath) throws IOException, RDF4JException {
BufferedWriter graphFileWriter = new BufferedWriter(new FileWriter(dotFilesPath + issue.getId() + ".dot"));
BufferedWriter graphFileWriter = new BufferedWriter(new FileWriter(dotFilesPath + issue.getIssueDescriptor().getId() + ".dot"));
issue.getResult().generateReport(graphFileWriter, Result.ReportFormat.DOT);
graphFileWriter.close();
}
Expand Down Expand Up @@ -299,7 +301,7 @@ private void writeDQVReportBody(RDFWriter rdfFile,
private void writeTextReport(Issue issue, BufferedWriter writer)
throws IOException, RDF4JException
{
writer.write(createIssueHeader(issue));
writer.write(createIssueHeader(issue.getIssueDescriptor()));
writer.newLine();
issue.getResult().generateReport(writer, Result.ReportFormat.TXT, Result.ReportStyle.SHORT);

Expand Down
29 changes: 17 additions & 12 deletions src/main/java/at/ac/univie/mminf/qskos4j/cmd/VocEvaluate.java
Expand Up @@ -4,6 +4,7 @@
import at.ac.univie.mminf.qskos4j.issues.Issue;
import at.ac.univie.mminf.qskos4j.progress.ConsoleProgressMonitor;
import at.ac.univie.mminf.qskos4j.progress.StreamProgressMonitor;
import at.ac.univie.mminf.qskos4j.util.IssueDescriptor;
import at.ac.univie.mminf.qskos4j.util.vocab.InvalidRdfException;
import at.ac.univie.mminf.qskos4j.util.vocab.RepositoryBuilder;
import com.beust.jcommander.JCommander;
Expand Down Expand Up @@ -155,10 +156,10 @@ private void listIssuesOrEvaluate() throws RDF4JException, IOException
{
if (parsedCommand.vocabFilenames == null) {
if (parsedCommand instanceof CommandAnalyze) {
outputIssueDetails(Issue.IssueType.ANALYTICAL);
outputIssueDetails(IssueDescriptor.IssueType.ANALYTICAL);
}
else {
outputIssueDetails(Issue.IssueType.STATISTICAL);
outputIssueDetails(IssueDescriptor.IssueType.STATISTICAL);
}
}
else {
Expand All @@ -167,15 +168,17 @@ private void listIssuesOrEvaluate() throws RDF4JException, IOException
}
}

private void outputIssueDetails(Issue.IssueType constraintType) {
private void outputIssueDetails(IssueDescriptor.IssueType constraintType) {
for (Issue issue : qskos.getAllIssues()) {
if (issue.getType() == constraintType) {
IssueDescriptor issueDescriptor = issue.getIssueDescriptor();

if (issueDescriptor.getType() == constraintType) {
System.out.println("---");
System.out.println("ID: " +issue.getId());
System.out.println("Name: " +issue.getName());
System.out.println("Description: " +issue.getDescription());
if (issue.getWeblink() != null) {
System.out.println("Further Informaton: <" +issue.getWeblink().stringValue()+ ">");
System.out.println("ID: " +issueDescriptor.getId());
System.out.println("Name: " +issueDescriptor.getName());
System.out.println("Description: " +issueDescriptor.getDescription());
if (issueDescriptor.getWeblink() != null) {
System.out.println("Further Informaton: <" +issueDescriptor.getWeblink().toString()+ ">");
}
}
}
Expand Down Expand Up @@ -278,9 +281,11 @@ private Collection<Issue> getAllIssuesForCommand() {

for (Issue issue : qskos.getAllIssues()) {
String command = jc.getParsedCommand();

if ((issue.getType() == Issue.IssueType.ANALYTICAL && command.equals(CMD_NAME_ANALYZE)) ||
(issue.getType() == Issue.IssueType.STATISTICAL && command.equals(CMD_NAME_SUMMARIZE)))

IssueDescriptor.IssueType issueType = issue.getIssueDescriptor().getType();

if ((issueType == IssueDescriptor.IssueType.ANALYTICAL && command.equals(CMD_NAME_ANALYZE)) ||
(issueType == IssueDescriptor.IssueType.STATISTICAL && command.equals(CMD_NAME_SUMMARIZE)))
{
issuesForCommand.add(issue);
}
Expand Down
Expand Up @@ -3,6 +3,7 @@
import at.ac.univie.mminf.qskos4j.issues.Issue;
import at.ac.univie.mminf.qskos4j.issues.concepts.InvolvedConcepts;
import at.ac.univie.mminf.qskos4j.progress.MonitoredIterator;
import at.ac.univie.mminf.qskos4j.util.IssueDescriptor;
import at.ac.univie.mminf.qskos4j.util.graph.NamedEdge;
import at.ac.univie.mminf.qskos4j.util.vocab.SparqlPrefix;
import org.jgrapht.DirectedGraph;
Expand All @@ -12,7 +13,6 @@
import org.eclipse.rdf4j.model.Resource;
import org.eclipse.rdf4j.model.IRI;
import org.eclipse.rdf4j.model.Value;
import org.eclipse.rdf4j.model.impl.IRIImpl;
import org.eclipse.rdf4j.query.BindingSet;
import org.eclipse.rdf4j.query.QueryLanguage;
import org.eclipse.rdf4j.query.TupleQuery;
Expand Down Expand Up @@ -40,12 +40,14 @@ public class DisconnectedConceptClusters extends Issue<ClustersResult> {
private InvolvedConcepts involvedConcepts;

public DisconnectedConceptClusters(InvolvedConcepts involvedConcepts) {
super(involvedConcepts,
super(new IssueDescriptor.Builder(
"dcc",
"Disconnected Concept Clusters",
"Finds sets of concepts that are isolated from the rest of the vocabulary",
IssueType.ANALYTICAL,
new IRIImpl("https://github.com/cmader/qSKOS/wiki/Quality-Issues#disconnected-concept-clusters")
IssueDescriptor.IssueType.ANALYTICAL)
.weblink("https://github.com/cmader/qSKOS/wiki/Quality-Issues#disconnected-concept-clusters")
.dependentIssue(involvedConcepts)
.build()
);
this.involvedConcepts = involvedConcepts;
}
Expand Down
Expand Up @@ -2,6 +2,7 @@

import at.ac.univie.mminf.qskos4j.issues.Issue;
import at.ac.univie.mminf.qskos4j.result.NumberResult;
import at.ac.univie.mminf.qskos4j.util.IssueDescriptor;
import at.ac.univie.mminf.qskos4j.util.TupleQueryResultUtil;
import at.ac.univie.mminf.qskos4j.util.vocab.SparqlPrefix;
import org.eclipse.rdf4j.RDF4JException;
Expand All @@ -21,17 +22,17 @@ public class AggregationRelations extends Issue<NumberResult<Long>> {
"skos:topConceptOf, skos:hasTopConcept, skos:inScheme, skos:member, skos:memberList";

public AggregationRelations() {
super("ar",
super(new IssueDescriptor.Builder("ar",
"Aggregation Relations Count",
"Counts the statements relating resources to ConceptSchemes or Collections",
IssueType.STATISTICAL
IssueDescriptor.IssueType.STATISTICAL).build()
);
}

@Override
protected NumberResult<Long> invoke() throws RDF4JException {
TupleQuery query = repCon.prepareTupleQuery(QueryLanguage.SPARQL, createAggregationRelationsQuery());
return new NumberResult<Long>(TupleQueryResultUtil.countResults(query.evaluate()));
return new NumberResult<>(TupleQueryResultUtil.countResults(query.evaluate()));
}

private String createAggregationRelationsQuery() {
Expand Down
Expand Up @@ -2,6 +2,7 @@

import at.ac.univie.mminf.qskos4j.issues.Issue;
import at.ac.univie.mminf.qskos4j.result.NumberResult;
import at.ac.univie.mminf.qskos4j.util.IssueDescriptor;
import at.ac.univie.mminf.qskos4j.util.vocab.SkosOntology;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.model.Statement;
Expand All @@ -18,10 +19,10 @@
public class Collections extends Issue<NumberResult<Long>> {

public Collections() {
super("cc",
super(new IssueDescriptor.Builder("cc",
"Collection Count",
"Counts the involved Collections",
IssueType.STATISTICAL
IssueDescriptor.IssueType.STATISTICAL).build()
);
}

Expand All @@ -36,7 +37,7 @@ protected NumberResult<Long> invoke() throws RDF4JException {
}
result.close();

return new NumberResult<Long>(collectionCount);
return new NumberResult<>(collectionCount);
}

}
Expand Up @@ -5,9 +5,9 @@
import at.ac.univie.mminf.qskos4j.issues.labels.util.LabeledConcept;
import at.ac.univie.mminf.qskos4j.issues.labels.util.ResourceLabelsCollector;
import at.ac.univie.mminf.qskos4j.issues.labels.util.LabelConflictsResult;
import at.ac.univie.mminf.qskos4j.util.IssueDescriptor;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.model.Literal;
import org.eclipse.rdf4j.model.impl.IRIImpl;
import org.eclipse.rdf4j.repository.RepositoryConnection;

import java.util.Collection;
Expand All @@ -26,11 +26,12 @@ public class DisjointLabelsViolations extends Issue<LabelConflictsResult> {
private ResourceLabelsCollector resourceLabelsCollector;

public DisjointLabelsViolations(ResourceLabelsCollector resourceLabelsCollector) {
super("dlv",
super(new IssueDescriptor.Builder("dlv",
"Disjoint Labels Violation",
"Finds resources with identical entries for different label types",
IssueType.ANALYTICAL,
new IRIImpl("https://github.com/cmader/qSKOS/wiki/Quality-Issues#disjoint-labels-violation"));
IssueDescriptor.IssueType.ANALYTICAL)
.weblink("https://github.com/cmader/qSKOS/wiki/Quality-Issues#disjoint-labels-violation")
.build());

this.resourceLabelsCollector = resourceLabelsCollector;
}
Expand Down
Expand Up @@ -3,6 +3,7 @@
import at.ac.univie.mminf.qskos4j.issues.Issue;
import at.ac.univie.mminf.qskos4j.issues.labels.util.EmptyLabelsResult;
import at.ac.univie.mminf.qskos4j.issues.labels.util.LabelType;
import at.ac.univie.mminf.qskos4j.util.IssueDescriptor;
import at.ac.univie.mminf.qskos4j.util.vocab.SparqlPrefix;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.model.Resource;
Expand All @@ -19,7 +20,10 @@ public class EmptyLabeledResources extends Issue<EmptyLabelsResult> {
private Map<Resource, Collection<LabelType>> result;

public EmptyLabeledResources() {
super("el", "Empty Labels", "Finds empty labels or labels containing only whitespaces", IssueType.ANALYTICAL);
super(new IssueDescriptor.Builder("el",
"Empty Labels",
"Finds empty labels or labels containing only whitespaces",
IssueDescriptor.IssueType.ANALYTICAL).build());
}

@Override
Expand Down
Expand Up @@ -6,9 +6,9 @@
import at.ac.univie.mminf.qskos4j.issues.labels.util.LabeledConcept;
import at.ac.univie.mminf.qskos4j.issues.labels.util.ResourceLabelsCollector;
import at.ac.univie.mminf.qskos4j.issues.labels.util.LabelConflictsResult;
import at.ac.univie.mminf.qskos4j.util.IssueDescriptor;
import org.eclipse.rdf4j.RDF4JException;
import org.eclipse.rdf4j.model.Value;
import org.eclipse.rdf4j.model.impl.IRIImpl;
import org.eclipse.rdf4j.repository.RepositoryConnection;

import java.util.ArrayList;
Expand All @@ -26,11 +26,13 @@ public class InconsistentPrefLabels extends Issue<LabelConflictsResult> {
private ResourceLabelsCollector resourceLabelsCollector;

public InconsistentPrefLabels(ResourceLabelsCollector resourceLabelsCollector) {
super("ipl",
super(new IssueDescriptor.Builder("ipl",
"Inconsistent Preferred Labels",
"Finds resources with more then one prefLabel per language",
IssueType.ANALYTICAL,
new IRIImpl("https://github.com/cmader/qSKOS/wiki/Quality-Issues#inconsistent-preferred-labels"));
IssueDescriptor.IssueType.ANALYTICAL)
.weblink("https://github.com/cmader/qSKOS/wiki/Quality-Issues#inconsistent-preferred-labels")
.build()
);

this.resourceLabelsCollector = resourceLabelsCollector;
}
Expand Down

0 comments on commit 83f04bf

Please sign in to comment.