Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Help applying RDF/ODM profile
Help applying RDF/ODM profile [message #757531] Fri, 18 November 2011 19:22 Go to next message
mchicalski  is currently offline mchicalski Friend
Messages: 1
Registered: November 2011
Junior Member
hi all,

first of all this is the first profile I'm trying to apply using the uml2 api..
also, I cant load this xmi file through eclipse..

profile: Ontology Definition Metamodel

I was following the tutorial Introduction to UML2 Profiles..

I'll appreciate any advice!

sample code:

import java.util.Collection;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.common.util.WrappedException;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.uml2.uml.Model;
import org.eclipse.uml2.uml.Profile;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.UMLFactory;
import org.eclipse.uml2.uml.UMLPackage;
import org.eclipse.uml2.uml.resource.XMI2UMLResource;
* @author mauricio
public class EMF {
private static ResourceSet RESOURCE_SET = new ResourceSetImpl();

* @param args the command line arguments
public static void main(String[] args) {
URI uriprofile = URI.createURI("h**").appendSegment("08-09-09").appendFileExtension(XMI2UMLResource.FILE_EXTENSION);
System.out.println("URI-> "+ uriprofile);
Collection<Profile> profiles = loadProfiles(uriprofile);
Profile rdfProfile = null;
for (Profile p : profiles) {
if (p.getLabel().equals("RDF"))
rdfProfile = p;
EList<Stereotype> stps = rdfProfile.getOwnedStereotypes();
for (Stereotype stp : stps) {
System.out.println("stereotype-> " + stp.getKeyword());
org.eclipse.uml2.uml.Class myclass, otherclass;
Model model = UMLFactory.eINSTANCE.createModel();
myclass = model.createOwnedClass("HelloWorld", true);
otherclass = model.createOwnedClass("OtherClass", false);



protected static void registerResourceFactories() {

protected static Collection<org.eclipse.uml2.uml.Profile> loadProfiles(URI uri) {
Collection<org.eclipse.uml2.uml.Profile> profiles = null;
try {
Resource resource = RESOURCE_SET.getResource(uri, true);
profiles = EcoreUtil.getObjectsByType(resource.getContents(), UMLPackage.Literals.PROFILE);
} catch (WrappedException we) {
return profiles;

stack trace:
Exception in thread "main" java.lang.IllegalArgumentException: org.eclipse.uml2.uml.internal.impl.StereotypeImpl@4c2b349d (name: rdfsClass, visibility: <unset>) (isLeaf: false, isAbstract: false) (isActive: false)
at org.eclipse.uml2.uml.internal.operations.ElementOperations.applyStereotype(
at org.eclipse.uml2.uml.internal.impl.ElementImpl.applyStereotype(
at testexmi.EMF.main(
Java Result: 1
Re: Help applying RDF/ODM profile [message #1488004 is a reply to message #757531] Wed, 26 November 2014 08:27 Go to previous message
Missing name Mising name is currently offline Missing name Mising nameFriend
Messages: 4
Registered: January 2011
Junior Member

Please I'm a biginner I want to know What versin of Eclipse I must download and the plugings required?

Previous Topic:Allocation relationship
Next Topic:How to specify unspecified navigability?
Goto Forum:

Current Time: Sun Jun 26 03:08:36 GMT 2022

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

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

Back to the top