|
|
|
@ -1,5 +1,6 @@
|
|
|
|
|
package eu.dnetlib.validator2.validation.guideline.openaire;
|
|
|
|
|
|
|
|
|
|
//import com.google.gson.Gson;
|
|
|
|
|
import eu.dnetlib.validator2.engine.Status;
|
|
|
|
|
import eu.dnetlib.validator2.validation.XMLApplicationProfile;
|
|
|
|
|
import eu.dnetlib.validator2.validation.guideline.*;
|
|
|
|
@ -9,8 +10,7 @@ import org.w3c.dom.Document;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
|
|
import static eu.dnetlib.validator2.validation.guideline.Cardinality.ONE;
|
|
|
|
|
import static eu.dnetlib.validator2.validation.guideline.Cardinality.ONE_TO_N;
|
|
|
|
|
import static eu.dnetlib.validator2.validation.guideline.Cardinality.*;
|
|
|
|
|
|
|
|
|
|
public final class FAIR_Data_GuidelinesProfile extends AbstractOpenAireProfile {
|
|
|
|
|
|
|
|
|
@ -289,80 +289,80 @@ public final class FAIR_Data_GuidelinesProfile extends AbstractOpenAireProfile {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TODO this goes to FAIRProfile
|
|
|
|
|
class MetadataCompleteness extends AbstractGuideline<Document> {
|
|
|
|
|
|
|
|
|
|
public MetadataCompleteness() {
|
|
|
|
|
super("MetadataCompleteness", 40);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Result validate(String id, Document t) {
|
|
|
|
|
DataArchiveGuidelinesV2Profile profile = new DataArchiveGuidelinesV2Profile();
|
|
|
|
|
|
|
|
|
|
// <></>ODO: iterate over results and build one Guideline.Result
|
|
|
|
|
try {
|
|
|
|
|
// System.out.println("Processing MetadataCompleteness...");
|
|
|
|
|
XMLApplicationProfile.ValidationResult res = profile.validate(id, t);
|
|
|
|
|
Map<String, Result> results = res.results();
|
|
|
|
|
int MaxScoreMetadataCompleteness = (int) ((res.score()*getWeight())/100);
|
|
|
|
|
|
|
|
|
|
// System.out.println("Max score DataValidator(%): " + res.score());
|
|
|
|
|
// System.out.println("Weight FAIRG: " + getWeight());
|
|
|
|
|
// System.out.println("Max score MetadataCompleteness: " + MaxScoreMetadataCompleteness);
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
|
|
|
|
|
// for (Map.Entry entry : results.entrySet()) {
|
|
|
|
|
// System.out.println(entry.getKey() + " = " + entry.getValue());
|
|
|
|
|
//// TODO this goes to FAIRProfile
|
|
|
|
|
//class MetadataCompleteness extends AbstractGuideline<Document> {
|
|
|
|
|
//
|
|
|
|
|
// public MetadataCompleteness() {
|
|
|
|
|
// super("MetadataCompleteness", 40);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public Result validate(String id, Document t) {
|
|
|
|
|
// DataArchiveGuidelinesV2Profile profile = new DataArchiveGuidelinesV2Profile();
|
|
|
|
|
//
|
|
|
|
|
// // <></>ODO: iterate over results and build one Guideline.Result
|
|
|
|
|
// try {
|
|
|
|
|
//// System.out.println("Processing MetadataCompleteness...");
|
|
|
|
|
// XMLApplicationProfile.ValidationResult res = profile.validate(id, t);
|
|
|
|
|
// Map<String, Result> results = res.results();
|
|
|
|
|
// int MaxScoreMetadataCompleteness = (int) ((res.score()*getWeight())/100);
|
|
|
|
|
//
|
|
|
|
|
//// System.out.println("Max score DataValidator(%): " + res.score());
|
|
|
|
|
//// System.out.println("Weight FAIRG: " + getWeight());
|
|
|
|
|
//// System.out.println("Max score MetadataCompleteness: " + MaxScoreMetadataCompleteness);
|
|
|
|
|
//// System.out.println("\n\n\n\n");
|
|
|
|
|
//
|
|
|
|
|
//// for (Map.Entry entry : results.entrySet()) {
|
|
|
|
|
//// System.out.println(entry.getKey() + " = " + entry.getValue());
|
|
|
|
|
//// }
|
|
|
|
|
//// System.out.println(score);
|
|
|
|
|
// return getResult(MaxScoreMetadataCompleteness);
|
|
|
|
|
//
|
|
|
|
|
//// System.out.println(tempp.status() + " - " + tempp.score());
|
|
|
|
|
//// String printout = results.entrySet().stream().
|
|
|
|
|
//// map(entry -> entry.getValue() + ": " + entry.getKey()).collect(Collectors.joining("\n"));
|
|
|
|
|
//// System.out.println(printout);
|
|
|
|
|
//
|
|
|
|
|
//// System.out.println("\n\n\n\n");
|
|
|
|
|
// } catch (Exception e) {
|
|
|
|
|
// System.out.println(e.getMessage());
|
|
|
|
|
// System.out.println(e);
|
|
|
|
|
// e.printStackTrace();
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// private static Result getResult(int score) {
|
|
|
|
|
// String aa;
|
|
|
|
|
// aa = (score > 0) ? "SUCCESS" : "FAILURE";
|
|
|
|
|
// return new Result() {
|
|
|
|
|
// @Override
|
|
|
|
|
// public int score() {
|
|
|
|
|
// return score;
|
|
|
|
|
// }
|
|
|
|
|
// System.out.println(score);
|
|
|
|
|
return getResult(MaxScoreMetadataCompleteness);
|
|
|
|
|
|
|
|
|
|
// System.out.println(tempp.status() + " - " + tempp.score());
|
|
|
|
|
// String printout = results.entrySet().stream().
|
|
|
|
|
// map(entry -> entry.getValue() + ": " + entry.getKey()).collect(Collectors.joining("\n"));
|
|
|
|
|
// System.out.println(printout);
|
|
|
|
|
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
System.out.println(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Result getResult(int score) {
|
|
|
|
|
String aa;
|
|
|
|
|
aa = (score > 0) ? "SUCCESS" : "FAILURE";
|
|
|
|
|
return new Result() {
|
|
|
|
|
@Override
|
|
|
|
|
public int score() {
|
|
|
|
|
return score;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Status status() {
|
|
|
|
|
// return null;
|
|
|
|
|
return Status.valueOf(aa);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> warnings() { return null; }
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> errors() {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public String internalError() {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public Status status() {
|
|
|
|
|
//// return null;
|
|
|
|
|
// return Status.valueOf(aa);
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public Iterable<String> warnings() { return null; }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public Iterable<String> errors() {
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
//
|
|
|
|
|
// @Override
|
|
|
|
|
// public String internalError() {
|
|
|
|
|
// return null;
|
|
|
|
|
// }
|
|
|
|
|
// };
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
class F2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
|
|
|
|
@ -374,39 +374,47 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
public Result validate(String id, Document t) {
|
|
|
|
|
F2_01M profile = new F2_01M();
|
|
|
|
|
|
|
|
|
|
// <></>ODO: iterate over results and build one Guideline.Result
|
|
|
|
|
// TODO: iterate over results and build one Guideline.Result
|
|
|
|
|
try {
|
|
|
|
|
System.out.println("\nRich metadata is provided to allow discovery");
|
|
|
|
|
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
|
|
|
|
|
Map<String, Result> results = res_F.results();
|
|
|
|
|
int MaxScoreF2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
|
|
|
|
|
|
|
|
|
|
// Get actual score and not (%) to incorporate to FAIR score
|
|
|
|
|
final int MaxScoreF2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
|
|
|
|
|
|
|
|
|
|
// System.out.println("Max score DataValidator(%): " + res_F.score());
|
|
|
|
|
// System.out.println("Weight FAIRG: " + getWeight());
|
|
|
|
|
// System.out.println("Max score F2_01M_SPEC: " + MaxScoreF2_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
for (Map.Entry entry : results.entrySet()) {
|
|
|
|
|
System.out.println(entry.getKey() + " = " + entry.getValue());
|
|
|
|
|
ArrayList<String> warnings2 = new ArrayList<>();
|
|
|
|
|
ArrayList<String> errors2 = new ArrayList<>();
|
|
|
|
|
int score = 0;
|
|
|
|
|
for (Map.Entry entry : res_F.results().entrySet()) {
|
|
|
|
|
if (res_F.results().get(entry.getKey()).warnings().toString().length() > 2) {
|
|
|
|
|
warnings2.add(res_F.results().get(entry.getKey()).warnings().toString());
|
|
|
|
|
}
|
|
|
|
|
if (res_F.results().get(entry.getKey()).errors().toString().length() > 2) {
|
|
|
|
|
errors2.add(res_F.results().get(entry.getKey()).errors().toString());
|
|
|
|
|
}
|
|
|
|
|
if (entry.getValue().toString().contains("SUCCESS")) {
|
|
|
|
|
score += 2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return getResult(MaxScoreF2_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println(tempp.status() + " - " + tempp.score());
|
|
|
|
|
// String printout = results.entrySet().stream().
|
|
|
|
|
// map(entry -> entry.getValue() + ": " + entry.getKey()).collect(Collectors.joining("\n"));
|
|
|
|
|
// System.out.println(printout);
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
final Result ress = getResult(warnings2, errors2, score);
|
|
|
|
|
|
|
|
|
|
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
System.out.println(e);
|
|
|
|
|
e.printStackTrace();}
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Result getResult(int score) {
|
|
|
|
|
String aa;
|
|
|
|
|
aa = (score > 0) ? "SUCCESS" : "FAILURE";
|
|
|
|
|
|
|
|
|
|
private static Result getResult(ArrayList<String> warnings2, ArrayList<String> errors2, int score) {
|
|
|
|
|
|
|
|
|
|
return new Result() {
|
|
|
|
|
@Override
|
|
|
|
|
public int score() {
|
|
|
|
@ -415,18 +423,17 @@ class F2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Status status() {
|
|
|
|
|
// return null;
|
|
|
|
|
return Status.valueOf(aa);
|
|
|
|
|
return Status.valueOf((score > 0) ? "SUCCESS" : "FAILURE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> warnings() {
|
|
|
|
|
return null;
|
|
|
|
|
return warnings2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> errors() {
|
|
|
|
|
return null;
|
|
|
|
|
return errors2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -445,9 +452,9 @@ class F3_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
public Result validate(String id, Document t) {
|
|
|
|
|
F3_01M profile = new F3_01M();
|
|
|
|
|
|
|
|
|
|
// <></>ODO: iterate over results and build one Guideline.Result
|
|
|
|
|
// TODO: iterate over results and build one Guideline.Result
|
|
|
|
|
try {
|
|
|
|
|
System.out.println("\nMetadata includes the identifier for the data");
|
|
|
|
|
// System.out.println("\nMetadata includes the identifier for the data");
|
|
|
|
|
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
|
|
|
|
|
Map<String, Result> results = res_F.results();
|
|
|
|
|
// int MaxScoreF3_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
|
|
|
|
@ -460,32 +467,30 @@ class F3_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
MaxScoreF3_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// System.out.println("% score DataValidator: " + res_F.score());
|
|
|
|
|
// System.out.println("Weight FAIRG: " + getWeight());
|
|
|
|
|
// System.out.println("Max score F3_01M_SPEC: " + MaxScoreF3_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
for (Map.Entry entry : results.entrySet()) {
|
|
|
|
|
System.out.println(entry.getKey() + " = " + entry.getValue());
|
|
|
|
|
ArrayList<String> warnings2 = new ArrayList<>();
|
|
|
|
|
ArrayList<String> errors2 = new ArrayList<>();
|
|
|
|
|
for (Map.Entry entry : res_F.results().entrySet()) {
|
|
|
|
|
if (res_F.results().get(entry.getKey()).warnings().toString().length() > 2) {
|
|
|
|
|
warnings2.add(res_F.results().get(entry.getKey()).warnings().toString());
|
|
|
|
|
}
|
|
|
|
|
if (res_F.results().get(entry.getKey()).errors().toString().length() > 2) {
|
|
|
|
|
errors2.add(res_F.results().get(entry.getKey()).errors().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return getResult(MaxScoreF3_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println(tempp.status() + " - " + tempp.score());
|
|
|
|
|
// String printout = results.entrySet().stream().
|
|
|
|
|
// map(entry -> entry.getValue() + ": " + entry.getKey()).collect(Collectors.joining("\n"));
|
|
|
|
|
// System.out.println(printout);
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
final Result ress = getResult(warnings2, errors2, MaxScoreF3_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
System.out.println(e);
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
private static Result getResult(ArrayList<String> warnings2, ArrayList<String> errors2, int score) {
|
|
|
|
|
|
|
|
|
|
private static Result getResult(int score) {
|
|
|
|
|
String aa;
|
|
|
|
|
aa = (score > 0) ? "SUCCESS" : "FAILURE";
|
|
|
|
|
return new Result() {
|
|
|
|
|
@Override
|
|
|
|
|
public int score() {
|
|
|
|
@ -494,18 +499,17 @@ class F3_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Status status() {
|
|
|
|
|
// return null;
|
|
|
|
|
return Status.valueOf(aa);
|
|
|
|
|
return Status.valueOf((score > 0) ? "SUCCESS" : "FAILURE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> warnings() {
|
|
|
|
|
return null;
|
|
|
|
|
return warnings2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> errors() {
|
|
|
|
|
return null;
|
|
|
|
|
return errors2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -524,9 +528,9 @@ class I2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
public Result validate(String id, Document t) {
|
|
|
|
|
I2_01M profile = new I2_01M();
|
|
|
|
|
|
|
|
|
|
// <></>ODO: iterate over results and build one Guideline.Result
|
|
|
|
|
// TODO: iterate over results and build one Guideline.Result
|
|
|
|
|
try {
|
|
|
|
|
System.out.println("\nMetadata uses FAIR-compliant vocabularies");
|
|
|
|
|
// System.out.println("\nMetadata uses FAIR-compliant vocabularies");
|
|
|
|
|
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
|
|
|
|
|
Map<String, Result> results = res_F.results();
|
|
|
|
|
// int MaxScoreI2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
|
|
|
|
@ -539,21 +543,21 @@ class I2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
MaxScoreI2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// System.out.println("% score DataValidator: " + res_F.score());
|
|
|
|
|
// System.out.println("Weight FAIRG: " + getWeight());
|
|
|
|
|
// System.out.println("Max score I2_01M_SPEC: " + MaxScoreI2_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
for (Map.Entry entry : results.entrySet()) {
|
|
|
|
|
System.out.println(entry.getKey() + " = " + entry.getValue());
|
|
|
|
|
ArrayList<String> warnings2 = new ArrayList<>();
|
|
|
|
|
ArrayList<String> errors2 = new ArrayList<>();
|
|
|
|
|
for (Map.Entry entry : res_F.results().entrySet()) {
|
|
|
|
|
if (res_F.results().get(entry.getKey()).warnings().toString().length() > 2) {
|
|
|
|
|
warnings2.add(res_F.results().get(entry.getKey()).warnings().toString());
|
|
|
|
|
}
|
|
|
|
|
if (res_F.results().get(entry.getKey()).errors().toString().length() > 2) {
|
|
|
|
|
errors2.add(res_F.results().get(entry.getKey()).errors().toString());
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return getResult(MaxScoreI2_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println(tempp.status() + " - " + tempp.score());
|
|
|
|
|
// String printout = results.entrySet().stream().
|
|
|
|
|
// map(entry -> entry.getValue() + ": " + entry.getKey()).collect(Collectors.joining("\n"));
|
|
|
|
|
// System.out.println(printout);
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
final Result ress = getResult(warnings2, errors2, MaxScoreI2_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
System.out.println(e);
|
|
|
|
@ -562,9 +566,8 @@ class I2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Result getResult(int score) {
|
|
|
|
|
String aa;
|
|
|
|
|
aa = (score > 0) ? "SUCCESS" : "FAILURE";
|
|
|
|
|
private static Result getResult(ArrayList<String> warnings2, ArrayList<String> errors2, int score) {
|
|
|
|
|
|
|
|
|
|
return new Result() {
|
|
|
|
|
@Override
|
|
|
|
|
public int score() {
|
|
|
|
@ -573,18 +576,17 @@ class I2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Status status() {
|
|
|
|
|
return null;
|
|
|
|
|
// return Status.valueOf(aa);
|
|
|
|
|
return Status.valueOf((score > 0) ? "SUCCESS" : "FAILURE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> warnings() {
|
|
|
|
|
return null;
|
|
|
|
|
return warnings2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> errors() {
|
|
|
|
|
return null;
|
|
|
|
|
return errors2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -603,28 +605,32 @@ class R1_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
public Result validate(String id, Document t) {
|
|
|
|
|
R1_01M profile = new R1_01M();
|
|
|
|
|
|
|
|
|
|
// <></>ODO: iterate over results and build one Guideline.Result
|
|
|
|
|
// TODO: iterate over results and build one Guideline.Result
|
|
|
|
|
try {
|
|
|
|
|
System.out.println("\nPlurality of accurate and relevant attributes are provided to allow reuse");
|
|
|
|
|
// System.out.println("\nPlurality of accurate and relevant attributes are provided to allow reuse");
|
|
|
|
|
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
|
|
|
|
|
Map<String, Result> results = res_F.results();
|
|
|
|
|
int MaxScoreR1_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
|
|
|
|
|
|
|
|
|
|
// System.out.println("% score DataValidator: " + res_F.score());
|
|
|
|
|
// System.out.println("Weight FAIRG: " + getWeight());
|
|
|
|
|
// System.out.println("Max score R1_01M_SPEC: " + MaxScoreR1_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
for (Map.Entry entry : results.entrySet()) {
|
|
|
|
|
System.out.println(entry.getKey() + " = " + entry.getValue());
|
|
|
|
|
ArrayList<String> warnings2 = new ArrayList<>();
|
|
|
|
|
ArrayList<String> errors2 = new ArrayList<>();
|
|
|
|
|
int score = 0;
|
|
|
|
|
for (Map.Entry entry : res_F.results().entrySet()) {
|
|
|
|
|
if (res_F.results().get(entry.getKey()).warnings().toString().length() > 2) {
|
|
|
|
|
warnings2.add(res_F.results().get(entry.getKey()).warnings().toString());
|
|
|
|
|
}
|
|
|
|
|
if (res_F.results().get(entry.getKey()).errors().toString().length() > 2) {
|
|
|
|
|
errors2.add(res_F.results().get(entry.getKey()).errors().toString());
|
|
|
|
|
}
|
|
|
|
|
if (entry.getValue().toString().contains("SUCCESS")) {
|
|
|
|
|
score += 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return getResult(MaxScoreR1_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println(tempp.status() + " - " + tempp.score());
|
|
|
|
|
// String printout = results.entrySet().stream().
|
|
|
|
|
// map(entry -> entry.getValue() + ": " + entry.getKey()).collect(Collectors.joining("\n"));
|
|
|
|
|
// System.out.println(printout);
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
final Result ress = getResult(warnings2, errors2, score);
|
|
|
|
|
|
|
|
|
|
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
System.out.println(e);
|
|
|
|
@ -633,8 +639,8 @@ class R1_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Result getResult(int score) {
|
|
|
|
|
String aa = (score > 0) ? "SUCCESS" : "FAILURE";
|
|
|
|
|
private static Result getResult(ArrayList<String> warnings2, ArrayList<String> errors2, int score) {
|
|
|
|
|
|
|
|
|
|
return new Result() {
|
|
|
|
|
@Override
|
|
|
|
|
public int score() {
|
|
|
|
@ -643,18 +649,17 @@ class R1_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Status status() {
|
|
|
|
|
return null;
|
|
|
|
|
// return Status.valueOf(aa);
|
|
|
|
|
return Status.valueOf((score > 0) ? "SUCCESS" : "FAILURE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> warnings() {
|
|
|
|
|
return null;
|
|
|
|
|
return warnings2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> errors() {
|
|
|
|
|
return null;
|
|
|
|
|
return errors2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@ -673,28 +678,33 @@ class R1_2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
public Result validate(String id, Document t) {
|
|
|
|
|
R1_2_01M profile = new R1_2_01M();
|
|
|
|
|
|
|
|
|
|
// <></>ODO: iterate over results and build one Guideline.Result
|
|
|
|
|
// TODO: iterate over results and build one Guideline.Result
|
|
|
|
|
try {
|
|
|
|
|
System.out.println("\nMetadata includes provenance information according to a cross-community language");
|
|
|
|
|
// System.out.println("\nMetadata includes provenance information according to a cross-community language");
|
|
|
|
|
XMLApplicationProfile.ValidationResult res_F = profile.validate(id, t);
|
|
|
|
|
Map<String, Result> results = res_F.results();
|
|
|
|
|
int MaxScoreR1_2_01M_SPEC = (int) ((res_F.score()*getWeight())/100);
|
|
|
|
|
|
|
|
|
|
// System.out.println("% score DataValidator: " + res_F.score());
|
|
|
|
|
// System.out.println("Weight FAIRG: " + getWeight());
|
|
|
|
|
// System.out.println("Max score R1_2_01M_SPEC: " + MaxScoreR1_2_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
for (Map.Entry entry : results.entrySet()) {
|
|
|
|
|
System.out.println(entry.getKey() + " = " + entry.getValue());
|
|
|
|
|
ArrayList<String> warnings2 = new ArrayList<>();
|
|
|
|
|
ArrayList<String> errors2 = new ArrayList<>();
|
|
|
|
|
int score = 0;
|
|
|
|
|
for (Map.Entry entry : res_F.results().entrySet()) {
|
|
|
|
|
if (res_F.results().get(entry.getKey()).warnings().toString().length() > 2) {
|
|
|
|
|
warnings2.add(res_F.results().get(entry.getKey()).warnings().toString());
|
|
|
|
|
}
|
|
|
|
|
if (res_F.results().get(entry.getKey()).errors().toString().length() > 2) {
|
|
|
|
|
errors2.add(res_F.results().get(entry.getKey()).errors().toString());
|
|
|
|
|
}
|
|
|
|
|
if (entry.getValue().toString().contains("SUCCESS")) {
|
|
|
|
|
score += 3;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return getResult(MaxScoreR1_2_01M_SPEC);
|
|
|
|
|
|
|
|
|
|
// System.out.println(tempp.status() + " - " + tempp.score());
|
|
|
|
|
// String printout = results.entrySet().stream().
|
|
|
|
|
// map(entry -> entry.getValue() + ": " + entry.getKey()).collect(Collectors.joining("\n"));
|
|
|
|
|
// System.out.println(printout);
|
|
|
|
|
// System.out.println("\n\n\n\n");
|
|
|
|
|
final Result ress = getResult(warnings2, errors2, score);
|
|
|
|
|
|
|
|
|
|
return new StandardResult(ress.score(), ress.status(), (List<String>) ress.warnings(), (List<String>) ress.errors(), ress.internalError());
|
|
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
System.out.println(e.getMessage());
|
|
|
|
|
System.out.println(e);
|
|
|
|
@ -703,9 +713,8 @@ class R1_2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Result getResult(int score) {
|
|
|
|
|
String aa;
|
|
|
|
|
aa = (score > 0) ? "SUCCESS" : "FAILURE";
|
|
|
|
|
private static Result getResult(ArrayList<String> warnings2, ArrayList<String> errors2, int score) {
|
|
|
|
|
|
|
|
|
|
return new Result() {
|
|
|
|
|
@Override
|
|
|
|
|
public int score() {
|
|
|
|
@ -714,18 +723,17 @@ class R1_2_01M_SPEC extends AbstractGuideline<Document> {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Status status() {
|
|
|
|
|
// return null;
|
|
|
|
|
return Status.valueOf(aa);
|
|
|
|
|
return Status.valueOf((score > 0) ? "SUCCESS" : "FAILURE");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> warnings() {
|
|
|
|
|
return null;
|
|
|
|
|
return warnings2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public Iterable<String> errors() {
|
|
|
|
|
return null;
|
|
|
|
|
return errors2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|