Skip to content

Commit

Permalink
Update Protocol Pure classes
Browse files Browse the repository at this point in the history
  • Loading branch information
pierredebelen committed Nov 7, 2024
1 parent 095b66e commit c8012a6
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,15 +206,15 @@ Class meta::protocols::pure::vX_X_X::metamodel::domain::Property extends meta::p
defaultValue : meta::protocols::pure::vX_X_X::metamodel::domain::DefaultValue[0..1];
name : String[1];
multiplicity : meta::protocols::pure::vX_X_X::metamodel::domain::Multiplicity[1];
type : String[1];
genericType : meta::protocols::pure::vX_X_X::metamodel::type::GenericType[1];
propertyTypeSourceInformation: SourceInformation[0..1];
}

Class meta::protocols::pure::vX_X_X::metamodel::domain::QualifiedProperty extends meta::protocols::pure::vX_X_X::metamodel::domain::AnnotatedElement
{
name : String[1];
parameters : meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable[*];
returnType : String[1];
returnGenericType : meta::protocols::pure::vX_X_X::metamodel::type::GenericType[1];
returnMultiplicity : meta::protocols::pure::vX_X_X::metamodel::domain::Multiplicity[1];
body : meta::protocols::pure::vX_X_X::metamodel::valueSpecification::ValueSpecification[*];
}
Expand Down Expand Up @@ -254,7 +254,23 @@ Class meta::protocols::pure::vX_X_X::metamodel::domain::Unit
conversionFunction : meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::Lambda[0..1];
}

Class meta::protocols::pure::vX_X_X::metamodel::type::Type
{
_type : String[1];
}

Class meta::protocols::pure::vX_X_X::metamodel::type::PackageableType extends meta::protocols::pure::vX_X_X::metamodel::type::Type, meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::PackageableElementPtr
{

}

Class meta::protocols::pure::vX_X_X::metamodel::type::GenericType
{
rawType : meta::protocols::pure::vX_X_X::metamodel::type::Type[1];
typeArguments : meta::protocols::pure::vX_X_X::metamodel::type::GenericType[*];
multiplicityArguments : meta::protocols::pure::vX_X_X::metamodel::domain::Multiplicity[*];
typeVariableValues : meta::protocols::pure::vX_X_X::metamodel::valueSpecification::ValueSpecification[*];
}

Class meta::protocols::pure::vX_X_X::metamodel::valueSpecification::ValueSpecification
{
Expand All @@ -268,7 +284,7 @@ Class meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable ext
supportsStream : Boolean[0..1];
// To Remove
multiplicity : meta::protocols::pure::vX_X_X::metamodel::domain::Multiplicity[0..1];
class : String[0..1];
genericType : meta::protocols::pure::vX_X_X::metamodel::type::GenericType[0..1];
}

Class meta::protocols::pure::vX_X_X::metamodel::valueSpecification::application::FunctionApplication extends meta::protocols::pure::vX_X_X::metamodel::valueSpecification::ValueSpecification
Expand Down Expand Up @@ -310,9 +326,9 @@ Class meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::KeyExpr
expression: meta::protocols::pure::vX_X_X::metamodel::valueSpecification::ValueSpecification[1];
}

Class meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::GenericTypeInstance extends meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::PackageableElementPtr
Class meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::GenericTypeInstance extends meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::RawValue
{

genericType : meta::protocols::pure::vX_X_X::metamodel::type::GenericType[1];
}

Class meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::EnumValue extends meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::RawValue
Expand Down Expand Up @@ -842,7 +858,7 @@ Class meta::protocols::pure::vX_X_X::metamodel::domain::Function extends meta::p
{
preConstraints:meta::protocols::pure::vX_X_X::metamodel::domain::Constraint[*];
postConstraints:meta::protocols::pure::vX_X_X::metamodel::domain::Constraint[*];
returnType:String[1];
returnGenericType:meta::protocols::pure::vX_X_X::metamodel::type::GenericType[1];
returnMultiplicity:meta::protocols::pure::vX_X_X::metamodel::domain::Multiplicity[1];
parameters : meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable[*];
body : meta::protocols::pure::vX_X_X::metamodel::valueSpecification::ValueSpecification[*];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ function meta::protocols::pure::vX_X_X::transformation::fromPureGraph::execution
^meta::protocols::pure::vX_X_X::metamodel::executionPlan::FunctionParametersValidationNode(
_type = 'function-parameters-validation',
resultType = $exp.resultType->transformResultType($extensions),
functionParameters = $exp.functionParameters->map(p | ^meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable(_type='var', name=$p.name, supportsStream=$p.supportsStream, class=$p.type->elementToPath(), multiplicity=$p.multiplicity->isEmpty()->if(| [],| $p.multiplicity->toOne()->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformMultiplicity()))),
functionParameters = $exp.functionParameters->map(p | ^meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable(_type='var', name=$p.name, supportsStream=$p.supportsStream, genericType=^meta::protocols::pure::vX_X_X::metamodel::type::GenericType(rawType=^meta::protocols::pure::vX_X_X::metamodel::type::PackageableType(_type='packageableType', fullPath=$p.type->elementToPath())), multiplicity=$p.multiplicity->isEmpty()->if(| [],| $p.multiplicity->toOne()->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformMultiplicity()))),
parameterValidationContext = $exp.parameterValidationContext->map(p | $p->match([
e:meta::pure::executionPlan::EnumValidationContext[1] | ^meta::protocols::pure::vX_X_X::metamodel::executionPlan::EnumValidationContext(varName = $e.varName, validEnumValues = $e.validEnumValues, _type = 'enumValidationContext')
]))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ function <<access.private>> meta::protocols::pure::vX_X_X::transformation::fromP
defaultValue = if($property.defaultValue->isEmpty(),|[],|$property.defaultValue->toOne()->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformDefaultValue($extensions)->toOne()),
name = $property.name->toOne(),
multiplicity = $property.multiplicity->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformMultiplicity()->toOne(),
type = $property.genericType.rawType->toOne()->elementToPath(),
genericType = ^meta::protocols::pure::vX_X_X::metamodel::type::GenericType(rawType=^meta::protocols::pure::vX_X_X::metamodel::type::PackageableType(_type='packageableType', fullPath=$property.genericType.rawType->toOne()->elementToPath())),
stereotypes = $property.stereotypes->map(s|$s->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformStereotype()),
taggedValues = $property.taggedValues->map(t|$t->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformTaggedValue())
)
Expand All @@ -164,7 +164,7 @@ function <<access.private>> meta::protocols::pure::vX_X_X::transformation::fromP
(
name = $qualifiedProperty.name->toOne(),
parameters = $fType.parameters->tail()->map(p|$p->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::valueSpecification::transformValueSpecification([], newMap([]->cast(@Pair<String, List<Any>>)), true, $extensions)->cast(@meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable)),
returnType = $fType.returnType.rawType->toOne()->elementToPath(),
returnGenericType = ^meta::protocols::pure::vX_X_X::metamodel::type::GenericType(rawType=^meta::protocols::pure::vX_X_X::metamodel::type::PackageableType(_type='packageableType', fullPath=$fType.returnType.rawType->toOne()->elementToPath())),
returnMultiplicity = $fType.returnMultiplicity->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformMultiplicity()->toOne(),
body = $qualifiedProperty->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::valueSpecification::transformFunctionBody($useAppliedFunction, $extensions),
stereotypes = $qualifiedProperty.stereotypes->map(s|$s->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformStereotype()),
Expand Down Expand Up @@ -235,7 +235,7 @@ function meta::protocols::pure::vX_X_X::transformation::fromPureGraph::transform
parameters = $f->functionType().parameters->map(p |
$p->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::valueSpecification::transformValueSpecification([], ^Map<String, meta::pure::functions::collection::List<Any>>(), true, true, $extensions)->cast(@meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable)
),
returnType = $f->functionReturnType().rawType->toOne()->elementToPath(),
returnGenericType = ^meta::protocols::pure::vX_X_X::metamodel::type::GenericType(rawType=^meta::protocols::pure::vX_X_X::metamodel::type::PackageableType(_type='packageableType', fullPath=$f->functionReturnType().rawType->toOne()->elementToPath())),
returnMultiplicity = $f->functionReturnMultiplicity()->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformMultiplicity()->toOne(),
preConstraints = $f.preConstraints->map(c |$c->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformConstraint($extensions)),
postConstraints = $f.postConstraints->map(c |$c->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformConstraint($extensions)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,15 @@ function <<access.private>> meta::protocols::pure::vX_X_X::transformation::fromP
^meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::GenericTypeInstance
(
_type = 'genericTypeInstance',
fullPath = $v.genericType.rawType->toOne()->match([
d:DataType[1]|$d->makeString(),
c:Class<Any>[1]|$c->elementToPath()
])
genericType = ^meta::protocols::pure::vX_X_X::metamodel::type::GenericType(
rawType=^meta::protocols::pure::vX_X_X::metamodel::type::PackageableType(
_type = 'packageableType',
fullPath = $v.genericType.rawType->toOne()->match([
d:DataType[1]|$d->makeString(),
c:Class<Any>[1]|$c->elementToPath()
])
)
)
)
}

Expand All @@ -228,7 +233,7 @@ function <<access.private>> meta::protocols::pure::vX_X_X::transformation::fromP
_type = 'var',
multiplicity = $v.multiplicity->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::domain::transformMultiplicity(),
name = $v.name,
class = $v.genericType.rawType->toOne()->elementToPath()
genericType = ^meta::protocols::pure::vX_X_X::metamodel::type::GenericType(rawType=^meta::protocols::pure::vX_X_X::metamodel::type::PackageableType(_type='packageableType', fullPath=$v.genericType.rawType->toOne()->elementToPath()))
);
,|^meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable
(
Expand All @@ -241,7 +246,7 @@ function <<access.private>> meta::protocols::pure::vX_X_X::transformation::fromP

function <<access.private>> meta::protocols::pure::vX_X_X::transformation::fromPureGraph::valueSpecification::transformHackedUnit(v:ValueSpecification[1]):meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::GenericTypeInstance[1]
{
^meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::GenericTypeInstance(_type='genericTypeInstance', fullPath=$v.genericType.rawType->toOne()->elementToPath());
^meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::GenericTypeInstance(_type='genericTypeInstance', genericType=^meta::protocols::pure::vX_X_X::metamodel::type::GenericType(rawType=^meta::protocols::pure::vX_X_X::metamodel::type::PackageableType(_type='packageableType', fullPath=$v.genericType.rawType->toOne()->elementToPath())));
}

function <<access.private>> meta::protocols::pure::vX_X_X::transformation::fromPureGraph::valueSpecification::transformUnitInstance(v:ValueSpecification[1]):meta::protocols::pure::vX_X_X::metamodel::valueSpecification::UnitInstance[1]
Expand Down Expand Up @@ -773,9 +778,9 @@ function meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGra
function meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGrammar::classElementsToPure(as:Any[*], separator:String[1]):String[1]{
$as->map(a|$a->match([ c:meta::protocols::pure::vX_X_X::metamodel::domain::Class[1]| let nonAnySuperTypes = $c.superTypes->filter(s|$s != 'meta::pure::metamodel::type::Any');
'\nClass '+ if($c.stereotypes->isNotEmpty(),|'\t<<'+$c.stereotypes->classElementsToPure(',') + '>>\n',|'') + if($c.taggedValues->isNotEmpty(),|'\t{'+$c.taggedValues->classElementsToPure(',')+'}\n',|'') + if($c.package->isEmpty(),|$c.name,|$c.package->toOne()+'::'+$c.name) + if($nonAnySuperTypes->isNotEmpty(),| ' extends '+$nonAnySuperTypes->makeString(','),|'') +'\n{\n' + $c.properties->classElementsToPure('\n') + '\n' + $c.qualifiedProperties->classElementsToPure('\n')+'\n}\n';,
p:meta::protocols::pure::vX_X_X::metamodel::domain::Property[1]| if($p.stereotypes->isNotEmpty(),|'\t<<'+$p.stereotypes->classElementsToPure(',') + '>>\n',|'') + if($p.taggedValues->isNotEmpty(),|'\t{'+$p.taggedValues->classElementsToPure(',')+'}\n',|'') + '\t'+$p.name+':'+$p.type+'['+$p.multiplicity->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGrammar::mapToString() +'];',
q:meta::protocols::pure::vX_X_X::metamodel::domain::QualifiedProperty[1]| '\t'+$q.name+'('+$q.parameters->tail()->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGrammar::classElementsToPure(',')+'){'+$q.body->toPure()->replace('\n','')+'}:'+$q.returnType+'['+$q.returnMultiplicity->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGrammar::mapToString() +'];',
v:meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable[1]|$v.name + ':' + $v.class->toOne() +'['+$v.multiplicity->toOne()->mapToString()+']',
p:meta::protocols::pure::vX_X_X::metamodel::domain::Property[1]| if($p.stereotypes->isNotEmpty(),|'\t<<'+$p.stereotypes->classElementsToPure(',') + '>>\n',|'') + if($p.taggedValues->isNotEmpty(),|'\t{'+$p.taggedValues->classElementsToPure(',')+'}\n',|'') + '\t'+$p.name+':'+$p.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath+'['+$p.multiplicity->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGrammar::mapToString() +'];',
q:meta::protocols::pure::vX_X_X::metamodel::domain::QualifiedProperty[1]| '\t'+$q.name+'('+$q.parameters->tail()->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGrammar::classElementsToPure(',')+'){'+$q.body->toPure()->replace('\n','')+'}:'+$q.returnGenericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath+'['+$q.returnMultiplicity->meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGrammar::mapToString() +'];',
v:meta::protocols::pure::vX_X_X::metamodel::valueSpecification::Variable[1]|$v.name + ':' + $v.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath->toOne() +'['+$v.multiplicity->toOne()->mapToString()+']',
s:meta::protocols::pure::vX_X_X::metamodel::domain::StereotypePtr[1]|$s.profile+'.'+$s.value,
t:meta::protocols::pure::vX_X_X::metamodel::domain::TaggedValue[1]|$t.tag.profile+'.'+$t.tag.value+'=\''+$t.value->replace('\'','\\\'')->replace('\n',' ')+'\''
]))->makeString($separator)
Expand Down Expand Up @@ -892,13 +897,13 @@ function meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGra
l : Lambda[1]|
let pStr = $l.parameters->map(p|$p->match([
v : Variable[1]|
if ($v.class->isEmpty(),
if ($v.genericType->isEmpty(),
|$v.name,
|let cName = if($v.class->in([Float, Any, String, Integer, Boolean, Date, DateTime, StrictDate]->map(x|$x->makeString())),
| $v.class->toOne()->makeString(),
| if($v.class->toOne()->isInMeta(),
|$v.class->toOne()->substring($v.class->toOne()->lastIndexOf('::')+2),
|$v.class->toOne()
|let cName = if($v.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath->in([Float, Any, String, Integer, Boolean, Date, DateTime, StrictDate]->map(x|$x->makeString())),
| $v.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath->toOne()->makeString(),
| if($v.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath->toOne()->isInMeta(),
|$v.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath->toOne()->substring($v.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath->toOne()->lastIndexOf('::')+2),
|$v.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath->toOne()
);
)->toOne();
let m = $v.multiplicity->toOne()->mapToString();
Expand All @@ -910,14 +915,14 @@ function meta::protocols::pure::vX_X_X::transformation::fromPureGraph::toPureGra

'{%s|%s}'->format([$pStr, $bStr]);,
v : Variable[1]|'$' + $v.name,
hackedClass :meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::GenericTypeInstance[1]|'@' + $hackedClass.fullPath,
hackedClass :meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::GenericTypeInstance[1]|'@' + $hackedClass.genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath,
ci : ClassInstance[1] |
$ci.value->match(
[
aggValue : TDSAggregateValue[1]| 'agg(\'%s\', %s, %s)'->format([$aggValue.name, $state->toPure($aggValue.mapFn), $state->toPure($aggValue.aggregateFn)]),
aggValue : meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::AggregateValue[1]| 'agg(%s, %s)'->format([$state->toPure($aggValue.mapFn), $state->toPure($aggValue.aggregateFn)]),
sortInfo : TDSSortInformation[1]| '^SortInformation(column = \'%s\', direction = SortDirection.%s)'->format([$sortInfo.column, $sortInfo.direction]),
extendInfo: TDSColumnInformation[1] | '^BasicColumnSpecification<%s>(name = \'%s\', func = %s)'->format([$extendInfo.columnFn->cast(@Lambda).parameters->at(0).class->toOne(), $extendInfo.name, $state->toPure($extendInfo.columnFn)]),
extendInfo: TDSColumnInformation[1] | '^BasicColumnSpecification<%s>(name = \'%s\', func = %s)'->format([$extendInfo.columnFn->cast(@Lambda).parameters->at(0).genericType.rawType->cast(@meta::protocols::pure::vX_X_X::metamodel::type::PackageableType).fullPath->toOne(), $extendInfo.name, $state->toPure($extendInfo.columnFn)]),
path : Path[1]| '#/%s/%s%s#'->format([$path.startType, $path.path->map(p|$p->match([ppe:PropertyPathElement[1]|$ppe.property]))->joinStrings('.'), if($path.name->isEmpty() || ($path.name->toOne()->length() == 0), |'', |'!' + $path.name->toOne())]);,
or : meta::protocols::pure::vX_X_X::metamodel::valueSpecification::raw::TdsOlapRank[1]|
'^TdsOlapRank<TDSRow>(func = %s)'->format($state->toPure($or.function)),
Expand Down
Loading

0 comments on commit c8012a6

Please sign in to comment.