Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sirius » Defining Relation-based Edge for Xtext Domainmodel
Defining Relation-based Edge for Xtext Domainmodel [message #1634148] Wed, 25 February 2015 05:56 Go to next message
Akira Tanaka is currently offline Akira TanakaFriend
Messages: 86
Registered: March 2010
Member
I have a problem on defining relation-based edge (Sirius) for properties in Xtext's domainmodel example.

I am trying to define Sirius based graphical editor for Xtext's example domainmodel whose ecore model (generated by Xtext) is attached below.

I was able to define container representing "Entity" but was not successful for doing the same with edge representing Entity's reference to other Entity.

Xtext grammar is:
/*******************************************************************************
 * Copyright (c) 2009 itemis AG (http://www.itemis.eu) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/
grammar org.eclipse.xtext.example.domainmodel.Domainmodel with org.eclipse.xtext.xbase.Xbase

generate domainmodel "http://www.xtext.org/example/Domainmodel"

DomainModel:
	importSection=XImportSection?
	elements+=AbstractElement*;
	
AbstractElement:
	PackageDeclaration | Entity;

PackageDeclaration:
	'package' name=QualifiedName '{'
		elements+=AbstractElement*
	'}';

Entity:
	'entity' name=ValidID ('extends' superType=JvmParameterizedTypeReference)? '{'
		features+=Feature*
	'}';

Feature:
	Property | Operation;

Property:
	name=ValidID ':' type=JvmTypeReference;

Operation:
	'op' name=ValidID '(' (params+=FullJvmFormalParameter (',' params+=FullJvmFormalParameter)*)? ')' (':' type=JvmTypeReference)? 
		body=XBlockExpression;


Probably above is the same grammar as one found here (http://www.eclipse.org/Xtext/documentation.html#_6).

I would appreciate any advice on "target finder expression" in the edge definition. Do I need to define helper function in Java?

Thank you
Re: Defining Relation-based Edge for Xtext Domainmodel [message #1636579 is a reply to message #1634148] Thu, 26 February 2015 09:00 Go to previous messageGo to next message
Pierre-Charles David is currently offline Pierre-Charles DavidFriend
Messages: 522
Registered: July 2009
Senior Member
Le 25/02/2015 06:56, Akira Tanaka a écrit :
> I have a problem on defining relation-based edge (Sirius) for properties in Xtext's domainmodel example.
>
> I am trying to define Sirius based graphical editor for Xtext's example domainmodel whose ecore model (generated by Xtext) is attached below.
>
> I was able to define container representing "Entity" but was not successful for doing the same with edge representing Entity's reference to other Entity.

Maybe I'm missing something because I'm not familiar enough with Xtext,
but from a quick look at the .ecore, I don't see any way in which an
Entity references another Entity. The only references I see in an Entity
are to its "superTypes" (from JavaVMTypes.ecore), and to contained
Features, which themselves don't seem to have references to any Entity.

--
Pierre-Charles David - Obeo

Need professional services for Sirius?
http://www.obeodesigner.com/sirius


Pierre-Charles David - Obeo

Need training or professional services for Sirius?
http://www.obeodesigner.com/sirius
Re: Defining Relation-based Edge for Xtext Domainmodel [message #1636998 is a reply to message #1636579] Thu, 26 February 2015 13:36 Go to previous message
Akira Tanaka is currently offline Akira TanakaFriend
Messages: 86
Registered: March 2010
Member
Thank you very much for the response.

> The only references I see in an Entity are to its "superTypes" (from JavaVMTypes.ecore), and to contained Features, which themselves don't seem to have references to any Entity.

This is what I suspected. In Xtext, reference to other Entity would probably be resolved with Xbase (JvmTypeReference). I will try to modify the grammar (or .ecore file) to find cleaner target finder expression.

Thank you again for your help.
Akira Tanaka
Previous Topic:unrecognized variable 'container' in drop descripton
Next Topic:Import Excel file into a Table
Goto Forum:
  


Current Time: Wed Apr 01 22:22:19 GMT 2020

Powered by FUDForum. Page generated in 0.02206 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top