X-Git-Url: https://gerrit.simantics.org/r/gitweb?p=simantics%2Fplatform.git;a=blobdiff_plain;f=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fvalidation%2FReportCollisions.java;fp=bundles%2Forg.simantics.graph.compiler%2Fsrc%2Forg%2Fsimantics%2Fgraph%2Fcompiler%2Finternal%2Fvalidation%2FReportCollisions.java;h=30efe78c4797b50a282214f06616c6de5cec908c;hp=277ddc7b16cdb876d1bcef7760467a2e08519430;hb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;hpb=24e2b34260f219f0d1644ca7a138894980e25b14 diff --git a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/validation/ReportCollisions.java b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/validation/ReportCollisions.java index 277ddc7b1..30efe78c4 100644 --- a/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/validation/ReportCollisions.java +++ b/bundles/org.simantics.graph.compiler/src/org/simantics/graph/compiler/internal/validation/ReportCollisions.java @@ -1,59 +1,59 @@ -package org.simantics.graph.compiler.internal.validation; - -import java.util.Collection; - -import org.simantics.graph.compiler.GraphCompilerPreferences; -import org.simantics.graph.compiler.internal.store.LocationStore; -import org.simantics.graph.compiler.internal.templates.TemplateDefinitionStore; -import org.simantics.graph.query.Res; -import org.simantics.graph.store.GraphStore; -import org.simantics.graph.store.StatementCollision; -import org.simantics.ltk.Problem; - -public class ReportCollisions implements Runnable { - GraphCompilerPreferences preferences; - Collection problems; - GraphStore store; - - public ReportCollisions( - GraphCompilerPreferences preferences, Collection problems, - GraphStore store) { - this.preferences = preferences; - this.problems = problems; - this.store = store; - } - - private static String abbreviateURI(Res res) { - if(res == null) - return "null"; - String uri = res.toString(); - return uri.replace("http://www.simantics.org/", ""); - } - - @Override - public void run() { - LocationStore locations = store.getStore(LocationStore.class); - for(int c : store.values.getCollisions().toArray()) - problems.add(new Problem( - locations.getLocation(c), - "Two literal values are given for the same resource.")); - for(int c : store.identities.getCollisions().toArray()) - problems.add(new Problem( - locations.getLocation(c), - "Two different identities are given for the same resource.")); - for(int c : store.getStore(TemplateDefinitionStore.class).getCollisions().toArray()) - problems.add(new Problem( - locations.getLocation(c), - "Two template definitions are given for the same resource.")); - if(preferences.validate) - for(StatementCollision collision : store.statements.getCollisions()) { - problems.add(new Problem( - locations.getLocation(collision.subject), - "The same statement is defined " + collision.count + " times: " + - abbreviateURI(store.idToRes(collision.subject)) + ", " + - abbreviateURI(store.idToRes(collision.predicate)) + ", " + - abbreviateURI(store.idToRes(collision.object)))); - } - } - -} +package org.simantics.graph.compiler.internal.validation; + +import java.util.Collection; + +import org.simantics.graph.compiler.GraphCompilerPreferences; +import org.simantics.graph.compiler.internal.store.LocationStore; +import org.simantics.graph.compiler.internal.templates.TemplateDefinitionStore; +import org.simantics.graph.query.Res; +import org.simantics.graph.store.GraphStore; +import org.simantics.graph.store.StatementCollision; +import org.simantics.ltk.Problem; + +public class ReportCollisions implements Runnable { + GraphCompilerPreferences preferences; + Collection problems; + GraphStore store; + + public ReportCollisions( + GraphCompilerPreferences preferences, Collection problems, + GraphStore store) { + this.preferences = preferences; + this.problems = problems; + this.store = store; + } + + private static String abbreviateURI(Res res) { + if(res == null) + return "null"; + String uri = res.toString(); + return uri.replace("http://www.simantics.org/", ""); + } + + @Override + public void run() { + LocationStore locations = store.getStore(LocationStore.class); + for(int c : store.values.getCollisions().toArray()) + problems.add(new Problem( + locations.getLocation(c), + "Two literal values are given for the same resource.")); + for(int c : store.identities.getCollisions().toArray()) + problems.add(new Problem( + locations.getLocation(c), + "Two different identities are given for the same resource.")); + for(int c : store.getStore(TemplateDefinitionStore.class).getCollisions().toArray()) + problems.add(new Problem( + locations.getLocation(c), + "Two template definitions are given for the same resource.")); + if(preferences.validate) + for(StatementCollision collision : store.statements.getCollisions()) { + problems.add(new Problem( + locations.getLocation(collision.subject), + "The same statement is defined " + collision.count + " times: " + + abbreviateURI(store.idToRes(collision.subject)) + ", " + + abbreviateURI(store.idToRes(collision.predicate)) + ", " + + abbreviateURI(store.idToRes(collision.object)))); + } + } + +}