Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
139 changes: 139 additions & 0 deletions showcases/data/Essential/Functions/Standard/code.pure
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
###Relational
Database showcase::simple::store::TestDatabase
(
Table INTDEMO0
(
LEFTARG INTEGER,
RIGHTARG INTEGER
)
)


###Pure
function demo::bitOr(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*]
{
#>{showcase::simple::store::TestDatabase.INTDEMO0}#->from(
showcase::simple::connection::TestRuntime
)->extend(
~[
bitOr: x|$x.LEFTARG->bitOr(
$x.RIGHTARG
)
]
)
}

function demo::bitShiftLeft(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*]
{
#>{showcase::simple::store::TestDatabase.INTDEMO0}#->from(
showcase::simple::connection::TestRuntime
)->extend(
~[
bitShiftLeft: x|$x.LEFTARG->bitShiftLeft(
$x.RIGHTARG
)
]
)
}

function demo::bitXor(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*]
{
#>{showcase::simple::store::TestDatabase.INTDEMO0}#->from(
showcase::simple::connection::TestRuntime
)->extend(
~[
bitXor: x|$x.LEFTARG->bitXor(
$x.RIGHTARG
)
]
)
}

function demo::xor(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*]
{
#>{showcase::simple::store::TestDatabase.INTDEMO0}#->from(
showcase::simple::connection::TestRuntime
)->extend(
~[
LeftGreater: x|$x.LEFTARG >
$x.RIGHTARG,
RightGreater: x|$x.LEFTARG <
$x.RIGHTARG
]
)->extend(
~[
XOR: x|$x.LeftGreater->xor(
$x.RightGreater
)
]
)
}

function demo::bitNot(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*]
{
#>{showcase::simple::store::TestDatabase.INTDEMO0}#->from(
showcase::simple::connection::TestRuntime
)->extend(
~[
bitNotLeft: x|$x.LEFTARG->bitNot(),
bitNotRight: x|$x.RIGHTARG->bitNot()
]
)
}

function demo::bitShiftRight(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*]
{
#>{showcase::simple::store::TestDatabase.INTDEMO0}#->from(
showcase::simple::connection::TestRuntime
)->extend(
~[
bitShiftRight: x|$x.LEFTARG->bitShiftRight(
$x.RIGHTARG
)
]
)
}

function demo::bitAnd(): meta::pure::metamodel::relation::Relation<meta::pure::metamodel::type::Any>[*]
{
#>{showcase::simple::store::TestDatabase.INTDEMO0}#->from(
showcase::simple::connection::TestRuntime
)->extend(
~[
bitAnd: x|$x.LEFTARG->bitAnd(
$x.RIGHTARG
)
]
)
}


###Connection
RelationalDatabaseConnection showcase::simple::connection::TestConnection
{
store: showcase::simple::store::TestDatabase;
type: H2;
specification: LocalH2
{
testDataSetupSqls: [
'\nDrop table if exists INTDEMO0;\nCreate Table INTDEMO0(LEFTARG INTEGER, RIGHTARG INTEGER);\nInsert into INTDEMO0 (LEFTARG, RIGHTARG) values (1, 0);\nInsert into INTDEMO0 (LEFTARG, RIGHTARG) values (0, -1);\nInsert into INTDEMO0 (LEFTARG, RIGHTARG) values (-1, -1);\nInsert into INTDEMO0 (LEFTARG, RIGHTARG) values (1, 1);\n\n'
];
};
auth: DefaultH2;
}


###Runtime
Runtime showcase::simple::connection::TestRuntime
{
mappings:
[
];
connections:
[
showcase::simple::store::TestDatabase:
[
connection: showcase::simple::connection::TestConnection
]
];
}
6 changes: 6 additions & 0 deletions showcases/data/Essential/Functions/Standard/info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Standard Functions
description: Showcases some standard functions available on pure platform
---

Showcases some standard functions available on pure platform, applied on Relational TDS
2 changes: 1 addition & 1 deletion showcases/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<maven.surefire.thread.count>3</maven.surefire.thread.count>
<showcase.projects.location>data</showcase.projects.location>
<legend.engine.version>4.86.1</legend.engine.version>
<legend.engine.version>4.89.2</legend.engine.version>

</properties>

Expand Down