//© 2019 Dublin City University, Trinity College Dublin. All rights reserved. This material may not be reproduced, displayed, modified or distributed without the express prior written permission of the copyright holder. const prefix = ` PREFIX qpro: PREFIX rdf: PREFIX dqm-prob: `; export const UndefinedClassesAndPropertiesMetric = (qualityGraph,dataGraph,observationURI,datasetSource) =>{ let query = ` SELECT ?ProblematicThing ?Subject ?Predicate ?Object ?FailedMertic ?Exception FROM NAMED <${qualityGraph}> FROM NAMED <${dataGraph}> WHERE { {GRAPH <${qualityGraph}> {?QualityProblem qpro:generatedBy ?Observation; a qpro:QualityProblem; qpro:isDescribedBy ?FailedMertic; qpro:problemStructure qpro:ModelContainer; qpro:problematicThing ?ProblematicPropertyOrClass}. } {{GRAPH <${qualityGraph}> {?ProblematicPropertyOrClass qpro:exceptionDescription ?Exception}. FILTER(?Exception IN (dqm-prob:UndefinedClass)). BIND(?ProblematicPropertyOrClass AS ?Object). } UNION {GRAPH <${qualityGraph}> {?ProblematicPropertyOrClass qpro:exceptionDescription ?Exception}. FILTER(?Exception IN (dqm-prob:UndefinedProperty)). BIND(?ProblematicPropertyOrClass AS ?Predicate). } } {${datasetSource} <${dataGraph}> {?Subject ?Predicate ?Object }. } BIND(COALESCE( IF(?Exception = dqm-prob:UndefinedClass, "Object",IF(?Exception = dqm-prob:UndefinedProperty, "Predicate","")) ) AS ?ProblematicThing). FILTER(str(?Observation) = "${observationURI}"). } `; return prefix + query; } export default {UndefinedClassesAndPropertiesMetric};