core.pure.dataQuality.dataQuality.pure Maven / Gradle / Ivy
// Copyright 2020 Goldman Sachs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import meta::pure::dataQuality::*;
import meta::pure::graphFetch::*;
Enum meta::pure::dataQuality::RuleType
{
StoreDefinition, MappingDefinition, ClassStructure, ClassConstraint, NoInput, InvalidInput
}
Enum meta::pure::dataQuality::EnforcementLevel
{
Critical, Error, Warn
}
Class meta::pure::dataQuality::Defect
{
id : String[0..1];
externalId : String[0..1];
message : String[0..1];
enforcementLevel : EnforcementLevel[0..1];
ruleDefinerPath : String[1];
ruleType : RuleType[1];
path : RelativePathNode[*];
}
Class meta::pure::dataQuality::Checked
{
defects : Defect[*];
source : Any[0..1];
value : T[0..1];
}
Class meta::pure::dataQuality::RelativePathNode
{
propertyName : String[1];
index : Integer[0..1];
}
function <> meta::pure::dataQuality::checked(collection: T[*]):Checked[*]
{
fail('Not implemented!');
$collection->map(e|^Checked(value=$e));
}
function meta::pure::dataQuality::defaultDefectTree():RootGraphFetchTree[1]
{
#{Defect {id, externalId, message, enforcementLevel, ruleType, ruleDefinerPath, path { propertyName, index }}}#
}
function meta::pure::dataQuality::checked(valueTree: RootGraphFetchTree[1], defectTree: RootGraphFetchTree[1]):RootGraphFetchTree>[1]
{
checked($valueTree, $defectTree, [])
}
function meta::pure::dataQuality::checked(valueTree: RootGraphFetchTree[1], defectTree: RootGraphFetchTree[1], sourceTree: RootGraphFetchTree[0..1]):RootGraphFetchTree>[1]
{
let castedClass = Checked->cast(@Class>);
let valuePropTree = ^PropertyGraphFetchTree(
property = $castedClass.properties->filter(p | $p.name == 'value')->toOne(),
subTrees = $valueTree.subTrees,
subType = $valueTree.class
);
let defectsPropTree = ^PropertyGraphFetchTree(
property = $castedClass.properties->filter(p | $p.name == 'defects')->toOne(),
subTrees = $defectTree.subTrees
);
let sourcePropTree = if($sourceTree->isNotEmpty(),
| ^PropertyGraphFetchTree(
property = $castedClass.properties->filter(p | $p.name == 'source')->toOne(),
subTrees = $sourceTree.subTrees,
subType = $sourceTree.class
);,
| []);
^RootGraphFetchTree>
(
class = $castedClass,
subTrees = $defectsPropTree->concatenate($sourcePropTree)->concatenate($valuePropTree)
);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy