Rdf2EcoreModel on my own RDF data

263 views
Skip to first unread message

Rafiki

unread,
Apr 24, 2012, 3:07:49 AM4/24/12
to emf4sw-emftriple-discuss
Hello Guillaume,
Sorry that i am getting on your nerves, but I really need some help.

I try to reuse your example Rdf2EcoreModel on my own RDF date. And as
you suggested in "http://groups.google.com/group/emftriple-discuss/
browse_thread/thread/5cd91a7a90d22112", I register the models with
code like this:

line-1- Models.register(Models.resource("WikiOWL.ecore", true));

line-2- RDF2Model r2m = new
RDF2Model(Models.resource("WikiOWL.ecore", true));
line-3- Resource model =
r2m.transform(Models.resource("WikiRDF.rdf", true));

it still works at line-2 and the variable "r2m" is fulled with data
from registred metadmodel "WikiOWL.ecore", but breaks down in line-3
because a "model element EPackage could not be found from Model", as
showed below:

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)
...

WikiOWL.ecore is a valid model and contains the classes and attributes/
references that i need.
I guess there is something wrong with my own RDF data "WikiRDF.rdf"
and I've struggled for a long time to findout a solution but without
success.
Could you help me?

P.S.: Some files:
[1]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/WikiOWL.owl
[3]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/WikiOWL.ecore
[5]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/WikiRDF.rdf
My code:
[2]https://github.com/udbxu/emf4sw/blob/master/examples/
com.emf4sw.owl.examples/src/com/emf4sw/owl/examples/wiki/
WikiRDF2EcoreModel.java

BRs
Rafiki Ji

Rafiki

unread,
Apr 24, 2012, 8:48:36 AM4/24/12
to emf4sw-emftriple-discuss
Sorry i have something to add:
the ecore metamodel WikiOWL.ecore, which is automatic generated from
from WikiOWL.owl with your OWL2EcoreExample.java is actually
invaild!

Right click on the Package and run Validate, it fails with this
reason:

Problems encounterd during validation

Reason:
Diagnosis of www_halowiki_org

The instance type name 'null' is not well formed

Aber how can i bring the WikiOWL.ecore to a "well formed" one?

Guillaume Hillairet

unread,
Apr 24, 2012, 1:51:41 PM4/24/12
to emftripl...@googlegroups.com
I made a small update to fix your problem, you should checkout the sources. Also you can use this repository to install jena http://ghillairet.github.com/p2 .

Now you should not generate an ecore model from this owl ontology, that does not seem to work, I made a simple ecore model that work with your data, see the attached file. It contains only 1 class (Subject) and the required annotations to load the rdf data into correct attributes/references.

wiki.ecore

Rafiki

unread,
Apr 26, 2012, 7:42:10 PM4/26/12
to emf4sw-emftriple-discuss
Hallo Ghillairet,

After i've done the update, there come out unresolved types because
that some "imports" could not be resolved:
The import "com.hp" cannot be resolved
The import "org.openrdf" cannot be resolved
I can not find those two packages com.hp and org.openrdf to reference
them.
Those projects were empty (with light blue icons in Project
Explore )after the update.
org.codehaus.jackson
org.codehaus.jackson.feature
org.openjena
org.openjena.feature
org.openrdf

I also have tried the "http://ghillairet.github.com/p2" to install
jena(i suppose you mean Apache2.7.0 Jena), but failed too:

Software being installed: Jena 2.7.0.201204111327
(org.apache.jena.feature.feature.group 2.7.0.201204111327)
Missing requirement: Jena 2.7.0.201204111327 (org.apache.jena
2.7.0.201204111327) requires 'package com.ibm.icu.lang 4.4.0' but it
could not be found
Cannot satisfy dependency:
From: Jena 2.7.0.201204111327
(org.apache.jena.feature.feature.group 2.7.0.201204111327)
To: org.apache.jena [2.7.0.201204111327]

Guillaume Hillairet

unread,
Apr 27, 2012, 7:50:12 AM4/27/12
to emftripl...@googlegroups.com
 
I also have tried the "http://ghillairet.github.com/p2" to install
jena(i suppose you mean Apache2.7.0 Jena), but failed too:


On which version of eclipse did you try? I just tried it on a clean 3.7.2 and works for me.
Steps:
 - download eclipse 3.7.2 (classic or modeling)
 - Install New Software -> Add http://ghillairet.github.com/p2
 - Select Apache Jena & Install

Go to emf4sw, run mvn clean install

It will generate a local update site in emf4sw/build/repository/target/repository

Reopen your eclipse, in Install New Software, Add for local update site the previous folder, and select the listed bundles.

You should now have the latest version of emf4sw installed.

Rafiki

unread,
Apr 27, 2012, 10:14:09 AM4/27/12
to emf4sw-emftriple-discuss
Hi, I actually tried it on Eclipse of version Helios 3.6.2.
> > On which version of eclipse did you try? I just tried it on a clean 3.7.2
I am now going to try your steps, thank you so much!

Rafiki

unread,
May 1, 2012, 2:33:43 PM5/1/12
to emf4sw-emftriple-discuss
Hi,
I have go though your steps. It installation works now.
As i run com.emf4sw.owl.examples, they throw NoClassDefFoundError
Exception . I guess there was something wrong with the Classpath
setting or dependency configuration.
-----------------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/
LoggerFactory
at com.hp.hpl.jena.util.Metadata.<clinit>(Metadata.java:39)
at...
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader$1.run(Unknown Source)
at...
... 15 more

-----------------------------------------------------------------------
And by com.emf4sw.rdf.examples produce warning :

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for
further details.

So as suggested here http://www.slf4j.org/codes.html#StaticLoggerBinder
i donwloaded and added
1) slf4j-api-1.6.4.jar
2) slf4j-simple-1.6.4.jar
to my class path.
The warning is no more there. But e.g. ReadOwlFile.java it produces
other Exception:
-------------------------
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/
xerces/util/XMLChar
at com.hp.hpl.jena.rdf.model.impl.Util.notNameChar(Util.java:108)
at com.hp.hpl.jena.rdf.model.impl.Util.splitNamespace(Util.java:
66)
at com.hp.hpl.jena.graph.Node_URI.getLocalName(Node_URI.java:76)
...
Caused by: java.lang.ClassNotFoundException:
org.apache.xerces.util.XMLChar
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
...
-----------------------------
Sorry to bother you,
BRs
Rafiki Ji

On 27 Apr., 13:50, Guillaume Hillairet <g.hillai...@gmail.com> wrote:
> > I also have tried the "http://ghillairet.github.com/p2" to install
> > jena(i suppose you mean Apache2.7.0 Jena), but failed too:
>
> > On which version of eclipse did you try? I just tried it on a clean 3.7.2
>
> and works for me.
>...

Rafiki

unread,
May 10, 2012, 3:45:38 AM5/10/12
to emf4sw-emftriple-discuss
Hallo,
I don't know why, after updating, i always NoClassDefFoundError of
slf4j package? and after add slf4j manuelly i got then
NoClassDefFoundError of "org/apache/xerces/util/XMLChar"

so desperated:-( Maybe anything wrong with your maven project
configuration?

BRs
Rafiki Ji

Rafiki

unread,
May 10, 2012, 4:03:10 AM5/10/12
to emf4sw-emftriple-discuss
After adding org.apache.xerces_2.9.0.jar (from eclipse/plugins) to
build path, it produced then other NoClassDefFoundError caused by
ClassNotFoundException.
As a newibe i don't know how to set the eclipse run classpath same to
the compile classpath.
Message has been deleted
Message has been deleted

Rafiki

unread,
Jun 8, 2012, 8:11:58 AM6/8/12
to emf4sw-emftriple-discuss
Hello Guillaume,
Sorry that i am getting on your nerves again, but I really need a
little bit help.
your wiki.ecore already works fine on the following RDF data

["http://semantic-mediawiki.org/swivt/1.0#wikiPageModificationDate"],
["http://semantic-mediawiki.org/swivt/1.0#wikiNamespace"],
["http://www.w3.org/2000/01/rdf-schema#label"]

Now I am tring to modifiy your "wiki.ecore" in oder to transfer
following three kinds of elements as well

["http://www.w3.org/2000/01/rdf-schema#isDefinedBy"],
["http://semantic-mediawiki.org/swivt/1.0#page"]
["http://www.w3.org/1999/02/22-rdf-syntax-ns#type"],

It work not. The problem is , those three properies [ page ],
[ IsDefinedBy ] and [ type ] are successfully created in .XMI file,
but their values are null.
that is to say, that rdf:resource="http://..." is not be transfered.

how could i modify at the right way?Thank you so much fi you could
have time to answer my question!.

BRs
Rafiki Ji
>  wiki.ecore
> 2KViewDownload

Guillaume Hillairet

unread,
Jun 11, 2012, 5:51:06 AM6/11/12
to emftripl...@googlegroups.com
Hi Rafiki,

It is probably because those resources (as triple's object) have no types, and thus cannot be converted into EObject.
What you can do is add some triples that give types to those resources.

BRs,
Guillaume
Reply all
Reply to author
Forward
0 new messages