Skip to content

Commit

Permalink
resolve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
YannanGao-gs committed Nov 14, 2024
1 parent 12c1c2e commit d6c77e2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ Class meta::analytics::mapping::modelCoverage::MappedPropertyInfo
qualifiers : MappedPropertyQualifier[*];
taggedValues: TaggedValueInfo[*];
stereotypes : StereotypeInfo[*];
classPath: String[*]; // use * to make this optional
isQualifiedProp: Boolean[*]; // use * to make this optional, when it's false or undefined, it means it's not a qualified prop
classPath: String[0..1]; // use 0..1 to make this optional
isQualifiedProp: Boolean[0..1]; // use 0..1 to make this optional, when it's false or undefined, it means it's not a qualified prop
}

Class meta::analytics::mapping::modelCoverage::MappedProperty
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,23 @@ function meta::analytics::mapping::modelCoverage::getRealProperty(property:Abstr
| $property);
}

function <<access.private>> meta::analytics::mapping::modelCoverage::buildTaggedValueInfo(taggedValue:TaggedValue[1]):TaggedValueInfo[1]
{
^TaggedValueInfo(tagOwner = $taggedValue.tag.profile->elementToPath(), tagValue = $taggedValue.tag.value, value = $taggedValue.value);
}

function <<access.private>> meta::analytics::mapping::modelCoverage::buildStereotypeInfo(stereotype: Stereotype[1]):StereotypeInfo[1]
{
^StereotypeInfo(profilePath = $stereotype.profile->elementToPath(), value = $stereotype.value);
}

function <<access.private>> meta::analytics::mapping::modelCoverage::buildPropertyInfo(p:AbstractProperty<Any>[1]):PropertyInfo[1]
{
let name = $p->originalPropertyNameForEdgePointProperty()->toOne();
^PropertyInfo(
taggedValues = $p.taggedValues->map(val | ^TaggedValueInfo(tagOwner = $val.tag.profile->elementToPath(), tagValue = $val.tag.value, value = $val.value)),
taggedValues = $p.taggedValues->map(val | buildTaggedValueInfo($val)),
qualifiers = $p->buildQualifiers(),
stereotypes = $p.stereotypes->map(val | ^StereotypeInfo(profilePath = $val.profile->elementToPath(), value = $val.value)),
stereotypes = $p.stereotypes->map(val | buildStereotypeInfo($val)),
name = $name,
multiplicity = $p.multiplicity
);
Expand Down Expand Up @@ -95,8 +105,8 @@ function meta::analytics::mapping::modelCoverage::getAllPropertyInfo(classMappin
function <<access.private>> meta::analytics::mapping::modelCoverage::buildClassInfo(class:Class<Any>[1]):ClassInfo[1]
{
^ClassInfo(
taggedValues = $class.taggedValues->map(val | ^TaggedValueInfo(tagOwner = $val.tag.profile->elementToPath(), tagValue = $val.tag.value, value = $val.value)),
stereotypes = $class.stereotypes->map(val | ^StereotypeInfo(profilePath = $val.profile->elementToPath(), value = $val.value)),
taggedValues = $class.taggedValues->map(val | buildTaggedValueInfo($val)),
stereotypes = $class.stereotypes->map(val | buildStereotypeInfo($val)),
qualifiedProperties = $class->qualifiedProperties())
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,31 +75,35 @@ function <<access.private>> meta::analytics::mapping::modelCoverage::buildProper
targetName:String[0..1],
propertyInfo:PropertyInfo[1],
config: AnalysisConfiguration[1],
isQualifiedProp: Boolean[*]
isQualifiedProp: Boolean[0..1]
): MappedProperty[1]
{
$type->match([
pt:PrimitiveType[1] |
^MappedProperty(name = $propertyInfo.name, info = if($config.returnMappedPropertyInfo == true,
| ^MappedPropertyInfo(
type = $type->mapType(),
multiplicity = $propertyInfo.multiplicity,
taggedValues = $propertyInfo.taggedValues,
qualifiers = $propertyInfo.qualifiers,
isQualifiedProp = $isQualifiedProp,
stereotypes = $propertyInfo.stereotypes),
^MappedProperty(
name = $propertyInfo.name,
info = if($config.returnMappedPropertyInfo == true,
| ^MappedPropertyInfo(
type = $type->mapType(),
multiplicity = $propertyInfo.multiplicity,
taggedValues = $propertyInfo.taggedValues,
qualifiers = $propertyInfo.qualifiers,
isQualifiedProp = $isQualifiedProp,
stereotypes = $propertyInfo.stereotypes),
| [])),
et:Enumeration<Any>[1] |
^EnumMappedProperty(
name = $propertyInfo.name, enumPath = $type->elementToPath(), info = if($config.returnMappedPropertyInfo == true,
name = $propertyInfo.name,
enumPath = $type->elementToPath(),
info = if($config.returnMappedPropertyInfo == true,
| ^MappedPropertyInfo(
type = MappedPropertyType.Enumeration,
taggedValues = $propertyInfo.taggedValues,
qualifiers = $propertyInfo.qualifiers,
stereotypes = $propertyInfo.stereotypes,
classPath = $type->elementToPath(),
isQualifiedProp = $isQualifiedProp,
multiplicity = $propertyInfo.multiplicity),
type = MappedPropertyType.Enumeration,
taggedValues = $propertyInfo.taggedValues,
qualifiers = $propertyInfo.qualifiers,
stereotypes = $propertyInfo.stereotypes,
classPath = $type->elementToPath(),
isQualifiedProp = $isQualifiedProp,
multiplicity = $propertyInfo.multiplicity),
| [])),
ot:Any[1] |
let subType = if ($p.genericType.rawType != $type,
Expand All @@ -114,7 +118,7 @@ function <<access.private>> meta::analytics::mapping::modelCoverage::buildProper
subType = $subType,
info = if($config.returnMappedPropertyInfo == true,
| ^MappedPropertyInfo(
type = MappedPropertyType.Entity,
type = MappedPropertyType.Entity,
multiplicity = $propertyInfo.multiplicity,
taggedValues = $propertyInfo.taggedValues,
qualifiers = $propertyInfo.qualifiers,
Expand Down

0 comments on commit d6c77e2

Please sign in to comment.