Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
model_join
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christopher
model_join
Commits
5b7e1cf3
Commit
5b7e1cf3
authored
5 years ago
by
Chrissi
Browse files
Options
Downloads
Patches
Plain Diff
add code for creating a new modelJoin query
parent
e86653bf
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/rosi_project/model_sync/modelrepresentation/ModelJoinCreation.java
+47
-1
47 additions, 1 deletion
...ect/model_sync/modelrepresentation/ModelJoinCreation.java
with
47 additions
and
1 deletion
src/main/java/org/rosi_project/model_sync/modelrepresentation/ModelJoinCreation.java
+
47
−
1
View file @
5b7e1cf3
...
@@ -3,6 +3,7 @@ package org.rosi_project.model_sync.modelrepresentation;
...
@@ -3,6 +3,7 @@ package org.rosi_project.model_sync.modelrepresentation;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
attributes
;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
attributes
;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
outgoing
;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
outgoing
;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
supertype
;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
supertype
;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
subtype
;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
naturalJoin
;
import
static
org
.
rosi_project
.
model_sync
.
model_join
.
representation
.
util
.
ModelJoinBuilder
.
naturalJoin
;
import
java.io.File
;
import
java.io.File
;
...
@@ -13,10 +14,20 @@ import org.rosi_project.model_sync.model_join.representation.grammar.ModelJoinEx
...
@@ -13,10 +14,20 @@ import org.rosi_project.model_sync.model_join.representation.grammar.ModelJoinEx
import
org.rosi_project.model_sync.model_join.representation.util.ModelJoinBuilder
;
import
org.rosi_project.model_sync.model_join.representation.util.ModelJoinBuilder
;
import
org.rosi_project.model_sync.model_join.representation.writer.*
;
import
org.rosi_project.model_sync.model_join.representation.writer.*
;
/**
* Create different ModelJoin Queries.
*
* @author Christopher
*/
public
class
ModelJoinCreation
{
public
class
ModelJoinCreation
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
ModelJoinCreation
mjc
=
new
ModelJoinCreation
();
//mjc.createModelJoinQueriesForSimpleLibrary();
mjc
.
createModelJoinQueriesForShrinkingEclipseLibrary
();
}
public
void
createModelJoinQueriesForSimpleLibrary
()
{
ClassResource
library
=
ClassResource
.
from
(
"lib"
,
"Library"
);
ClassResource
library
=
ClassResource
.
from
(
"lib"
,
"Library"
);
ClassResource
employee
=
ClassResource
.
from
(
"lib"
,
"Employee"
);
ClassResource
employee
=
ClassResource
.
from
(
"lib"
,
"Employee"
);
ClassResource
person
=
ClassResource
.
from
(
"lib"
,
"Person"
);
ClassResource
person
=
ClassResource
.
from
(
"lib"
,
"Person"
);
...
@@ -101,4 +112,39 @@ public class ModelJoinCreation {
...
@@ -101,4 +112,39 @@ public class ModelJoinCreation {
writerManager
.
write
(
mjManager
);
writerManager
.
write
(
mjManager
);
}
}
public
void
createModelJoinQueriesForShrinkingEclipseLibrary
()
{
ClassResource
library
=
ClassResource
.
from
(
"eclipse"
,
"Library"
);
ClassResource
book
=
ClassResource
.
from
(
"eclipse"
,
"Book"
);
ClassResource
circulatingItem
=
ClassResource
.
from
(
"eclipse"
,
"CirculatingItem"
);
ClassResource
item
=
ClassResource
.
from
(
"eclipse"
,
"Item"
);
AttributePath
libraryName
=
AttributePath
.
from
(
library
,
"name"
);
AttributePath
libraryStock
=
AttributePath
.
from
(
library
,
"stock"
);
AttributePath
itemTitle
=
AttributePath
.
from
(
item
,
"title"
);
AttributePath
bookPages
=
AttributePath
.
from
(
book
,
"pages"
);
ModelJoinExpression
mj
=
ModelJoinBuilder
.
createNewModelJoin
()
.
add
(
naturalJoin
()
.
join
(
library
)
.
with
(
library
)
.
as
(
library
)
.
keep
(
attributes
(
libraryName
))
.
keep
(
outgoing
(
libraryStock
)
.
as
(
circulatingItem
)
.
keep
(
attributes
(
itemTitle
))
.
keep
(
subtype
(
book
)
.
as
(
book
)
.
keep
(
attributes
(
bookPages
))
.
buildExpression
())
.
buildExpression
()
)
.
done
())
.
build
();
File
file
=
new
File
(
"shrinkingEclipse.modeljoin"
);
FileBasedModelJoinWriter
writer
=
new
FileBasedModelJoinWriter
(
file
);
writer
.
write
(
mj
);
}
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment