{"id":24775660,"url":"https://github.com/inseefr/ddi-lifecycle-java","last_synced_at":"2025-03-23T23:48:40.981Z","repository":{"id":215251899,"uuid":"738457319","full_name":"InseeFr/DDI-Lifecycle-Java","owner":"InseeFr","description":"Project to generate java classes to model DDI lifecycle documents","archived":false,"fork":false,"pushed_at":"2025-03-14T23:23:46.000Z","size":359,"stargazers_count":1,"open_issues_count":4,"forks_count":0,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-15T00:26:33.458Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/InseeFr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-03T09:18:55.000Z","updated_at":"2025-01-20T16:17:51.000Z","dependencies_parsed_at":"2024-02-09T10:31:47.797Z","dependency_job_id":"e94ed5d6-b028-4121-a590-6aad2798d372","html_url":"https://github.com/InseeFr/DDI-Lifecycle-Java","commit_stats":null,"previous_names":["inseefr/ddi-lifecycle-java"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFr%2FDDI-Lifecycle-Java","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFr%2FDDI-Lifecycle-Java/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFr%2FDDI-Lifecycle-Java/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/InseeFr%2FDDI-Lifecycle-Java/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/InseeFr","download_url":"https://codeload.github.com/InseeFr/DDI-Lifecycle-Java/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245186931,"owners_count":20574554,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-29T06:55:10.918Z","updated_at":"2025-03-23T23:48:40.942Z","avatar_url":"https://github.com/InseeFr.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DDI Lifecycle Java\n\nJava library that contains [DDI Lifecycle 3.3](https://ddialliance.org/Specification/DDI-Lifecycle/3.3/) \nclasses generated from XSD sources.\n\nClasses are generated using [Apache XMLBeans](https://xmlbeans.apache.org/documentation/index.html).\n\nThis library offers deserialization / serialization for DDI objects, using methods of the XMLBeans API.\n\n## Get started\n\n### Requirements\n\nJava 17 or above.\n\n### [Get the dependency](https://mvnrepository.com/artifact/fr.insee.ddi/ddi-lifecycle)\n\nMaven:\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003efr.insee.ddi\u003c/groupId\u003e\n    \u003cartifactId\u003eddi-lifecycle\u003c/artifactId\u003e\n    \u003cversion\u003e1.1.0\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nGradle:\n\n```kotlin\nimplementation(\"fr.insee.ddi:ddi-lifecycle:1.1.0\")\n```\n\n### Deserialize / serialize DDI objects\n\nDeserialization example:\n\n```java\nString xmlDDI = \"\"\"\n        \u003cDDIInstance xmlns=\"ddi:instance:3_3\"\n                     xmlns:r=\"ddi:reusable:3_3\"\n                     xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n                     xsi:schemaLocation=\"ddi:instance:3_3 https://www.ddialliance.org/Specification/DDI-Lifecycle/3.3/XMLSchema/instance.xsd\"\u003e\n           \u003cr:Agency\u003efr.insee\u003c/r:Agency\u003e\n           \u003cr:ID\u003eexample-id\u003c/r:ID\u003e\n           \u003cr:Version\u003e1\u003c/r:Version\u003e\n        \u003c/DDIInstance\u003e\n        \"\"\";\nDDIInstanceDocument ddiInstanceDocument = DDIInstanceDocument.Factory.parse(xmlDDI);\nDDIInstanceType ddiInstanceType = ddiInstanceDocument.getDDIInstance();\n```\n\nThe `parse(...)` method accepts various input types (url, file, input stream, etc.)\n\nEach DDI Lifecycle object has a \"Document\" class and a \"Type\" class created by XMLBeans. \nDocument classes are wrappers to deserialize or serialize xml content (with the root node). \nType classes are those to get or set values in java.\n\nTo serialize a DDI object, just call the `toString()` on any DDI document object.\n\nDeserialization/serialization is not restricted to the `DDIInstance` object. \nThis example can be applied to any DDI Lifecycle object: `CodeList`, `Sequence`, `QuestionItem`, `Variable`, etc.\n\nUseful link: [DDI model documentation](https://ddialliance.github.io/ddimodel-web/DDI-L-3.3/)\n\n## Other features\n\n### Indexing of a DDI object\n\nYou can index the objects contained within a DDI object.\n\n```java\nDDIIndex ddiIndex = new DDIIndex();\n// Perform indexing\nddiIndex.indexDDIObject(someDDIObject);\n// Get an object within the index\nAbstractIdentifiableType innerObject = ddiIndex.get(\"some-inner-object-id\");\n// The result can be typed\nVariableType variable = ddiIndex.get(\"some-variable-id\", VariableType.class);\n// Get the parent object in the hierarchy\nVariableSchemeType variableScheme = ddiIndex.getParent(\"some-variable-id\", VariableScheme.class);\n```\n\n### Utilities\n\nXMLBeans API is pretty verbose, a utility class of the lib offers some QOE methods:\n\n```java\nVariableType variable = VariableType.Factory.newInstance();\nDDIUtils.setIdValue(variable, \"foo-id\");\nDDIUtils.getIdValue(variable) // \"foo-id\"\nDDIUtils.ddiToString(variable) // \"VariableTypeImpl[id=foo-id]\"\n```\n\n## Requests\n\nIf you have a question, request or bug report, feel free to open an issue.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finseefr%2Fddi-lifecycle-java","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finseefr%2Fddi-lifecycle-java","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finseefr%2Fddi-lifecycle-java/lists"}