{"action":"created","issue":{"url":"https://api.github.com/repos/ghillairet/emfjson/issues/58","labels_url":"https://api.github.com/repos/ghillairet/emfjson/issues/58/labels{/name}","comments_url":"https://api.github.com/repos/ghillairet/emfjson/issues/58/comments","events_url":"https://api.github.com/repos/ghillairet/emfjson/issues/58/events","html_url":"https://github.com/ghillairet/emfjson/issues/58","id":95109558,"number":58,"title":"attribute serialization","user":{"login":"lex-em","id":1404372,"avatar_url":"https://avatars.githubusercontent.com/u/1404372?v=3","gravatar_id":"","url":"https://api.github.com/users/lex-em","html_url":"https://github.com/lex-em","followers_url":"https://api.github.com/users/lex-em/followers","following_url":"https://api.github.com/users/lex-em/following{/other_user}","gists_url":"https://api.github.com/users/lex-em/gists{/gist_id}","starred_url":"https://api.github.com/users/lex-em/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lex-em/subscriptions","organizations_url":"https://api.github.com/users/lex-em/orgs","repos_url":"https://api.github.com/users/lex-em/repos","events_url":"https://api.github.com/users/lex-em/events{/privacy}","received_events_url":"https://api.github.com/users/lex-em/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-07-15T05:24:15Z","updated_at":"2015-07-16T10:22:56Z","closed_at":null,"body":"Hi,\r\n\r\nI have a problen with json serialization of ecore model. I'm trying to create .uml and .json (with emfjson) files like this:\r\n```java\r\nResourceSet umlResourceSet;\r\n\r\n    @Before\r\n    public void prepare(){\r\n        umlResourceSet = new ResourceSetImpl();\r\n        umlResourceSet.setURIConverter(URIConverter.INSTANCE);\r\n        umlResourceSet.getResourceFactoryRegistry().getExtensionToFactoryMap().put(\"json\", new JsonResourceFactoryCit());\r\n        umlResourceSet.getPackageRegistry().put(EcorePackage.eNS_URI, EcorePackage.eINSTANCE);\r\n        UMLResourcesUtil.init(umlResourceSet);\r\n    }\r\n\r\n    @Test\r\n    public void test(){\r\n        List<EObject> eObjects = new ArrayList<>();\r\n        List<String> useCaseNames = Arrays.asList(\"Кредитовый перевод\",\r\n                \"Инициирование кредитового перевода\", \"Коммерческий платеж\",\r\n                \"Налоговый платеж\", \"Валютный платеж\", \"Межбанковский перевод\", \"Уведомление кредитора\");\r\n        List<String> actorNames = Arrays.asList(\"Дебитор\", \"Банк дебитора\", \"Банк-посредник\",\r\n                \"Кредитор\", \"Банк кредитора\");\r\n        Map<String, UseCase> useCaseList = new HashMap<>();\r\n        useCaseNames.stream().forEach(n -> {\r\n            UseCase uc = UMLFactory.eINSTANCE.createUseCase();\r\n            uc.setName(n);\r\n            useCaseList.put(n, uc);\r\n        });\r\n        org.eclipse.uml2.uml.Package p = UMLFactoryImpl.init().createPackage();\r\n        eObjects.add(p);\r\n        Resource primitiveLib = umlResourceSet.getResource(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI), true);\r\n        Package primitiveLibPackage = (Package) EcoreUtil.getObjectByType(primitiveLib.getContents(), UMLPackage.Literals.PACKAGE);\r\n        p.createPackageImport(primitiveLibPackage);\r\n        p.setName(\"NPModel\");\r\n        Resource profileLib = umlResourceSet.getResource(URI.createURI(\"model/ISO20022Profile.profile.uml\"), true);\r\n        Package isoP = (Package) EcoreUtil.getObjectByType(profileLib.getContents(), UMLPackage.Literals.PACKAGE);\r\n        p.applyProfile(isoP.containingProfile());\r\n        actorNames.stream().forEach(n -> p.createPackagedElement(n, UMLFactoryImpl.getPackage().getActor()));\r\n        isoP.containingProfile().getOwnedStereotypes().stream()\r\n                .filter(s -> s.getName().contains(\"BusinessRole\")).findFirst().ifPresent(st -> {\r\n            NamedElement el = p.getPackagedElement(\"Банк дебитора\");\r\n            eObjects.add(el.applyStereotype(st));\r\n        });\r\n        useCaseList.forEach((n, uc) -> p.getPackagedElements().add(uc));\r\n        Resource resource = umlResourceSet.createResource(URI.createURI(\"test.uml\"));\r\n        resource.getContents().addAll(eObjects);\r\n        try {\r\n            resource.save(null);\r\n        } catch (IOException e) {\r\n            e.printStackTrace();\r\n        }\r\n        Resource resourceJSON = umlResourceSet.createResource(URI.createURI(\"test.json\"));\r\n        resourceJSON.getContents().addAll(eObjects);\r\n        try {\r\n            resourceJSON.save(null);\r\n        } catch (IOException e) {\r\n            e.printStackTrace();\r\n        }\r\n    }\r\n```\r\n\r\nCreated .uml is right:\r\n```xml\r\n<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<xmi:XMI xmi:version=\"20131001\" xmlns:xmi=\"http://www.omg.org/spec/XMI/20131001\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:ISO20022Profile=\"http:///schemas/ISO20022Profile/_Z1baoCR_EeW-eZ1ZLTAX7g/50\" xmlns:ecore=\"http://www.eclipse.org/emf/2002/Ecore\" xmlns:uml=\"http://www.eclipse.org/uml2/5.0.0/UML\" xsi:schemaLocation=\"http:///schemas/ISO20022Profile/_Z1baoCR_EeW-eZ1ZLTAX7g/50 model/ISO20022Profile.profile.uml#_Z1fsECR_EeW-eZ1ZLTAX7g\">\r\n  <uml:Package xmi:id=\"_eJYk0CquEeWRmPUlcrfDwQ\" name=\"NPModel\">\r\n    <packageImport xmi:id=\"_eJYk0SquEeWRmPUlcrfDwQ\">\r\n      <importedPackage xmi:type=\"uml:Model\" href=\"pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0\"/>\r\n    </packageImport>\r\n    <packagedElement xmi:type=\"uml:Actor\" xmi:id=\"_eJYk0iquEeWRmPUlcrfDwQ\" name=\"Дебитор\"/>\r\n    <packagedElement xmi:type=\"uml:Actor\" xmi:id=\"_eJYk0yquEeWRmPUlcrfDwQ\" name=\"Банк дебитора\"/>\r\n    <packagedElement xmi:type=\"uml:Actor\" xmi:id=\"_eJYk1CquEeWRmPUlcrfDwQ\" name=\"Банк-посредник\"/>\r\n    <packagedElement xmi:type=\"uml:Actor\" xmi:id=\"_eJYk1SquEeWRmPUlcrfDwQ\" name=\"Кредитор\"/>\r\n    <packagedElement xmi:type=\"uml:Actor\" xmi:id=\"_eJYk1iquEeWRmPUlcrfDwQ\" name=\"Банк кредитора\"/>\r\n    <packagedElement xmi:type=\"uml:UseCase\" xmi:id=\"_eJYk1yquEeWRmPUlcrfDwQ\" name=\"Инициирование кредитового перевода\"/>\r\n    <packagedElement xmi:type=\"uml:UseCase\" xmi:id=\"_eJYk2CquEeWRmPUlcrfDwQ\" name=\"Межбанковский перевод\"/>\r\n    <packagedElement xmi:type=\"uml:UseCase\" xmi:id=\"_eJYk2SquEeWRmPUlcrfDwQ\" name=\"Коммерческий платеж\"/>\r\n    <packagedElement xmi:type=\"uml:UseCase\" xmi:id=\"_eJZL4CquEeWRmPUlcrfDwQ\" name=\"Уведомление кредитора\"/>\r\n    <packagedElement xmi:type=\"uml:UseCase\" xmi:id=\"_eJZL4SquEeWRmPUlcrfDwQ\" name=\"Кредитовый перевод\"/>\r\n    <packagedElement xmi:type=\"uml:UseCase\" xmi:id=\"_eJZL4iquEeWRmPUlcrfDwQ\" name=\"Налоговый платеж\"/>\r\n    <packagedElement xmi:type=\"uml:UseCase\" xmi:id=\"_eJZL4yquEeWRmPUlcrfDwQ\" name=\"Валютный платеж\"/>\r\n    <profileApplication xmi:id=\"_eJZL5CquEeWRmPUlcrfDwQ\">\r\n      <eAnnotations xmi:id=\"_eJZL5SquEeWRmPUlcrfDwQ\" source=\"http://www.eclipse.org/uml2/2.0.0/UML\">\r\n        <references xmi:type=\"ecore:EPackage\" href=\"model/ISO20022Profile.profile.uml#_Z1fsECR_EeW-eZ1ZLTAX7g\"/>\r\n      </eAnnotations>\r\n      <appliedProfile href=\"model/ISO20022Profile.profile.uml#_rspygA6UEeWHY4KRRC3kUQ\"/>\r\n    </profileApplication>\r\n  </uml:Package>\r\n  <ISO20022Profile:BusinessRole xmi:id=\"_eJZL5iquEeWRmPUlcrfDwQ\" base_NamedElement=\"_eJYk0yquEeWRmPUlcrfDwQ\" base_Actor=\"_eJYk0yquEeWRmPUlcrfDwQ\"/>\r\n</xmi:XMI>\r\n```\r\n\r\nBut .json is not, there no attributes (in this case \"name\" attribute):\r\n```javascript\r\n[\r\n  {\r\n    \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//Package\",\r\n    \"_id\": \"_ezM94CquEeWRmPUlcrfDwQ\",\r\n    \"packageImport\": [\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//PackageImport\",\r\n        \"_id\": \"_ezM94SquEeWRmPUlcrfDwQ\",\r\n        \"visibility\": \"public\",\r\n        \"importedPackage\": {\r\n          \"$ref\": \"pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0\"\r\n        },\r\n        \"importingNamespace\": {\r\n          \"$ref\": \"_ezM94CquEeWRmPUlcrfDwQ\"\r\n        }\r\n      }\r\n    ],\r\n    \"packagedElement\": [\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//Actor\",\r\n        \"_id\": \"_ezM94iquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//Actor\",\r\n        \"_id\": \"_ezM94yquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//Actor\",\r\n        \"_id\": \"_ezM95CquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//Actor\",\r\n        \"_id\": \"_ezM95SquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//Actor\",\r\n        \"_id\": \"_ezM95iquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//UseCase\",\r\n        \"_id\": \"_ezM95yquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//UseCase\",\r\n        \"_id\": \"_ezM96CquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//UseCase\",\r\n        \"_id\": \"_ezM96SquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//UseCase\",\r\n        \"_id\": \"_ezM96iquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//UseCase\",\r\n        \"_id\": \"_ezM96yquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//UseCase\",\r\n        \"_id\": \"_ezM97CquEeWRmPUlcrfDwQ\"\r\n      },\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//UseCase\",\r\n        \"_id\": \"_ezM97SquEeWRmPUlcrfDwQ\"\r\n      }\r\n    ],\r\n    \"profileApplication\": [\r\n      {\r\n        \"eClass\": \"http://www.eclipse.org/uml2/5.0.0/UML#//ProfileApplication\",\r\n        \"_id\": \"_ezM97iquEeWRmPUlcrfDwQ\",\r\n        \"eAnnotations\": [\r\n          {\r\n            \"eClass\": \"http://www.eclipse.org/emf/2002/Ecore#//EAnnotation\",\r\n            \"_id\": \"_ezM97yquEeWRmPUlcrfDwQ\",\r\n            \"source\": \"http://www.eclipse.org/uml2/2.0.0/UML\",\r\n            \"references\": [\r\n              {\r\n                \"$ref\": \"model/ISO20022Profile.profile.uml#_Z1fsECR_EeW-eZ1ZLTAX7g\"\r\n              }\r\n            ]\r\n          }\r\n        ],\r\n        \"appliedProfile\": {\r\n          \"$ref\": \"model/ISO20022Profile.profile.uml#_rspygA6UEeWHY4KRRC3kUQ\"\r\n        },\r\n        \"applyingPackage\": {\r\n          \"$ref\": \"_ezM94CquEeWRmPUlcrfDwQ\"\r\n        }\r\n      }\r\n    ]\r\n  },\r\n  {\r\n    \"eClass\": \"model/ISO20022Profile.profile.uml#_Z1hhpyR_EeW-eZ1ZLTAX7g\",\r\n    \"_id\": \"_ezNk8CquEeWRmPUlcrfDwQ\",\r\n    \"registrationStatus\": \"PROVISIONALLY_REGISTERED \",\r\n    \"base_NamedElement\": {\r\n      \"$ref\": \"_ezM94yquEeWRmPUlcrfDwQ\"\r\n    },\r\n    \"base_Actor\": {\r\n      \"$ref\": \"_ezM94yquEeWRmPUlcrfDwQ\"\r\n    }\r\n  }\r\n]\r\n```\r\n\r\nWhat happen? What I should do?"},"comment":{"url":"https://api.github.com/repos/ghillairet/emfjson/issues/comments/121920205","html_url":"https://github.com/ghillairet/emfjson/issues/58#issuecomment-121920205","issue_url":"https://api.github.com/repos/ghillairet/emfjson/issues/58","id":121920205,"user":{"login":"ghillairet","id":148045,"avatar_url":"https://avatars.githubusercontent.com/u/148045?v=3","gravatar_id":"","url":"https://api.github.com/users/ghillairet","html_url":"https://github.com/ghillairet","followers_url":"https://api.github.com/users/ghillairet/followers","following_url":"https://api.github.com/users/ghillairet/following{/other_user}","gists_url":"https://api.github.com/users/ghillairet/gists{/gist_id}","starred_url":"https://api.github.com/users/ghillairet/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ghillairet/subscriptions","organizations_url":"https://api.github.com/users/ghillairet/orgs","repos_url":"https://api.github.com/users/ghillairet/repos","events_url":"https://api.github.com/users/ghillairet/events{/privacy}","received_events_url":"https://api.github.com/users/ghillairet/received_events","type":"User","site_admin":false},"created_at":"2015-07-16T10:22:56Z","updated_at":"2015-07-16T10:22:56Z","body":"Checking that isUnsettable in that method is a mistake, will be removed in next version, see #59 \r\nTo get ids in 0.11, explicitly set the option like this:\r\n\r\n```java\r\nMap<String, Object> options = new HashMap<>();\r\noptions.put(EMFJs.OPTION_USE_ID, true);\r\n\r\nresource.save(options);\r\n```"}}