/*******************************************************************************\r
- * Copyright (c) 2007, 2010 Association for Decentralized Information Management\r
+ * Copyright (c) 2007, 2013 Association for Decentralized Information Management\r
* in Industry THTH ry.\r
* All rights reserved. This program and the accompanying materials\r
* are made available under the terms of the Eclipse Public License v1.0\r
);\r
if (rangeElement.getContext().size() == 0) {\r
// there is no context, this not a structural resource / object.\r
- Resource result = g.newResource();\r
- g.claim(result, Layer0.getInstance(g).InstanceOf, null, domainType);\r
+ Resource result = newResource(g, domainType);\r
return new StructuralResource(g,result);\r
} else {\r
if (rangeElement.getContext().size() == 1 && rangeElement.getContext().get(0).equals(rangeElement)) {\r
// Structural object's context is itself, we are instantiating a new structural model.\r
Resource type = rangeElement.getType();\r
- Resource result = g.newResource();\r
- g.claim(result, Layer0.getInstance(g).InstanceOf, null, type);\r
+ Resource result = newResource(g, type);\r
return new StructuralResource(g,result,result);\r
} else {\r
// Structural object's context is not itself, which means that the object is inside of a structural model.\r
throw new MappingException(e);\r
}\r
}\r
+ \r
+ protected Resource newResource(WriteGraph g, Resource type) throws DatabaseException {\r
+ Resource result = g.newResource();\r
+ g.claim(result, Layer0.getInstance(g).InstanceOf, null, type);\r
+ return result;\r
+ }\r
@Override\r
public IStructuralObject createRangeElement(ReadGraph g, StructuralResource domainElement)\r
throws MappingException {\r