how tom make the example from source run ---- build errors by importing source

79 views
Skip to first unread message

Rafiki

unread,
Mar 26, 2012, 3:09:48 AM3/26/12
to emf4sw-emftriple-discuss
Hello everyone,

I am a newbie to maven and git, really need some help

I'd like to run in Eclipse this example from Guillaume' EMF4SW here:
https://github.com/ghillairet/emf4sw/blob/master/examples/com.emf4sw.rdf.examples/src/com/emf4sw/rdf/examples/Rdf2EcoreModel.java.

So I forked and cloned your source with a Git-tool to a local folder.

And then I imported the project locally as a maven project (I use a
Eclispe plugin: Maven Integration SCM). But in this process the
console produced some >Build errors like those:

.....[a lot of output in blue color]

26.03.12 08:28:46 MESZ: Build errors for com.emf4sw.owl;
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.eclipse.tycho:tycho-compiler-plugin:0.12.0:compile
(default-compile) on project com.emf4sw.owl: Not a bundle project
MavenProject: com.emf4sw:com.emf4sw.owl:0.7.1-SNAPSHOT @ C:\Users\Jee
\emf4sw\bundles\com.emf4sw.owl\pom.xml

.....[a lot of output in blue color]

26.03.12 08:28:48 MESZ: Build errors for com.emf4sw.owl.transform;
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to
execute goal org.eclipse.tycho:tycho-compiler-plugin:0.12.0:compile
(default-compile) on project com.emf4sw.owl.transform: Not a bundle
project MavenProject: com.emf4sw:com.emf4sw.owl.transform:0.7.1-
SNAPSHOT @ C:\Users\Jee\emf4sw\bundles\com.emf4sw.owl.transform\pom.xml

ghillairet

unread,
Mar 26, 2012, 4:41:46 AM3/26/12
to emf4sw-emftriple-discuss
Hi Rafiki,

You can simply import the project in Eclipse as an existing project,
not as a maven project.
For your problem it seems that you are using maven 2, and since this
project is built using
maven tycho (http://www.eclipse.org/tycho/) you need maven 3.

BRs,
Guillaume

On Mar 26, 9:09 am, Rafiki <rafiki_jiweij...@hotmail.com> wrote:
> Hello everyone,
>
> I am a newbie to maven and git, really need some help
>
> I'd like to run in Eclipse this example from Guillaume' EMF4SW here:https://github.com/ghillairet/emf4sw/blob/master/examples/com.emf4sw.....

Rafiki

unread,
Mar 29, 2012, 7:40:33 PM3/29/12
to emf4sw-emftriple-discuss
Hi Guillaume,
Thank you for the answer! You are right, i did used a maven 2 plugin.
The importing works now. I can now run some of your example.

but the example Rdf2EcoreModel.java still doesn't works.

First it produces FileNotFoundException, In line 26 of
Rdf2EcoreModel.java, in "com.emf4sw.rdf.examples / src" there was no
"person.ttl" in your source on Github. So i copy the "person.ttl" from
"com.emf4sw.owl.examples / src". The FileNotFoundException was no more
there,
-------------------------------------------------------------------------------------------------------------------------------------
line-25- RDF2Model r2m = new RDF2Model(Models.resource("src/
person.ecore", true));
line-26- Resource model = r2m.transform(Models.resource("src/
person.ttl", true));
line-27-
line-28- model.setURI(URI.createURI("src/person.ttl.xmi"));
-------------------------------------------------------------------------------------------------------------------------------------
but after then it produces NullPointerException

Exception in thread "main" java.lang.NullPointerException
at
com.emf4sw.rdf.examples.Rdf2EcoreModel.main(Rdf2EcoreModel.java:28)

After debuging i know that the "model" is Null after execution of line
26, so that the line 28 produces a NullPointerException.
I am confused! Maybe the coping "person.ttl" from
"com.emf4sw.owl.examples / src" is wrong?


P.S.: i just want use your EMF4SW to load a RDF File(or model, which
is exported from a Semantic Mediawiki) into EMF for further model-to-
model transformation.

Best regards,
Rafiki

ghillairet

unread,
Mar 30, 2012, 10:49:58 AM3/30/12
to emftripl...@googlegroups.com

The file person.ttl from the owl examples does not contain any instances, that is why the resulting model is empty.

You can first run EcoreModelInRdf, that will generates the missing file person.model.ttl, then try again to run Rdf2EcoreModel.

BRs,
Guillaume

Rafiki

unread,
Apr 5, 2012, 12:49:01 AM4/5/12
to emf4sw-emftriple-discuss
Yes, it works now.
But as i tried to transform my own Rdf2EcoreModel on my own RDF date,
a "xxx.rdf" file from Export from a Semantic Mediawiki
(With help of OWL2Ecore i have already get a "xxx.ecore" which is also
a Export from a Semantic Mediawiki, and get xxx.ecore registered
before i run Rdf2EcoreModel on xxx.rdf )
it produced such error:

---------------------------------------
Exception in thread "main"
org.eclipse.m2m.atl.engine.emfvm.VMException: Could not find model
element EPackage from Model
Java Stack:
org.eclipse.m2m.atl.engine.emfvm.VMException: Could not find model
element EPackage from Model
at org.eclipse.m2m.atl.engine.emfvm.ASM.registerOperations(ASM.java:
243)
at org.eclipse.m2m.atl.engine.emfvm.ASM.run(ASM.java:185)
at
org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.internalLaunch(EMFVMLauncher.java:
170)
at
org.eclipse.m2m.atl.engine.emfvm.launch.EMFVMLauncher.launch(EMFVMLauncher.java:
139)
at com.atl.common.trans.Transformations$3.apply(Transformations.java:
191)
at com.atl.common.trans.Transformations$3.apply(Transformations.java:
1)
at
com.atl.common.trans.Transformations.transform(Transformations.java:
61)
at com.emf4sw.rdf.transform.RDF2Model.transform(RDF2Model.java:74)
at com.emf4sw.rdf.transform.RDF2Model.transform(RDF2Model.java:78)
at
com.emf4sw.owl.examples.RDFExport2EcoreModelJi.main(RDFExport2EcoreModelJi.java:
27)
Caused by: org.eclipse.m2m.atl.engine.emfvm.ASM
$SignatureParsingException: Could not find model element EPackage from
Model
at org.eclipse.m2m.atl.engine.emfvm.ASM.parseTypeInternal(ASM.java:
414)
at org.eclipse.m2m.atl.engine.emfvm.ASM.parseType(ASM.java:378)
at org.eclipse.m2m.atl.engine.emfvm.ASM.registerOperations(ASM.java:
240)
... 9 more
-------------------------------
if you have Any clue?

BRs,
Rafiki

Guillaume Hillairet

unread,
Apr 6, 2012, 5:56:31 AM4/6/12
to emftripl...@googlegroups.com
There is maybe something wrong with the registration of models. In your case you should have 
something like this in your code:

Models.register(Models.resource("wiki.ecore", true));

RDF2Model r2m = new RDF2Model(Models.resource("wiki.ecore", true));
Resource model = r2m.transform(Models.resource("wiki.rdf", true));

Where wiki.ecore is the Ecore model you have obtained have execution of OWL2Ecore on your wiki
ontology and wiki.rdf is the RDF data you want to translate into instances of wiki.ecore.

Now before executing RDF2Model you may want to check that wiki.ecore is a valid model. The transformation
OWL2Ecore does not give you a valid Ecore model each time, it really depends on the complexity of the ontology.
So make sure that wiki.ecore contains the classes and attributes/references you need to get a model from your RDF
data.

You can also add annotations on your Ecore model to tell the RDF2Model transformation what to look at. See this example of
Ecore model with annotations:

BRs,
Guillaume

Rafiki

unread,
Apr 6, 2012, 12:06:45 PM4/6/12
to emf4sw-emftriple-discuss
Thank you for your answer!

[1]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/WikiOWL.owl
[2]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/com/emf4sw/owl/examples/wiki/
WikiRDF2EcoreModel.java
[3]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/WikiOWL.ecore
[4]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/com/emf4sw/owl/examples/wiki/
WikiOWL2Ecore.java
[5]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/WikiRDF.rdf

Yes, i do have registred my own "WikiOWL.ecore"[3] in the code (as
same as your example) : WikiRDF2EcoreModel.java [2].
While "WikiOWL.owl"[1] is my owl data (exported from a Wiki tools SMW
+), I transformed it to a "WikiOWL.ecore"[3]
with the code here [4].

I don't know whether if "WikiOWL.ecore"[3] is vaild model or not, but
it can be opened with 'Sample Ecore Model Editor' in Eclipse. And
there is acutally a
a EPackage like <ecore:EPackage> .... </ecore:EPackage> as a root
element.

WikiRDF.rdf[5] is the RDF data i want to translate into instances of
WikiRDF.ecore. It is also a Export of the Wiki tools SMW+. Can it be
the problem, if it is a invaild model instance?

BRs
Rafiki




On 6 Apr., 11:56, Guillaume Hillairet <g.hillai...@gmail.com> wrote:
> There is maybe something wrong with the registration of models. In your case you should have
> something like this in your code:
>
> Models.register(Models.resource("wiki.ecore", true));
>
> RDF2Model r2m = new RDF2Model(Models.resource("wiki.ecore", true));
> Resource model = r2m.transform(Models.resource("wiki.rdf", true));
>
> Where wiki.ecore is the Ecore model you have obtained have execution of OWL2Ecore on your wiki
> ontology and wiki.rdf is the RDF data you want to translate into instances of wiki.ecore.
>
> Now before executing RDF2Model you may want to check that wiki.ecore is a valid model. The transformation
> OWL2Ecore does not give you a valid Ecore model each time, it really depends on the complexity of the ontology.
> So make sure that wiki.ecore contains the classes and attributes/references you need to get a model from your RDF
> data.
>
> You can also add annotations on your Ecore model to tell the RDF2Model transformation what to look at. See this example of
> Ecore model with annotations:https://github.com/ghillairet/emf4sw/blob/master/examples/com.emf4sw.....
>
> BRs,
> Guillaume
Reply all
Reply to author
Forward
0 new messages