Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested JSON parsing using two data source iterators #210

Open
sRam1404 opened this issue Jun 18, 2024 · 1 comment
Open

Nested JSON parsing using two data source iterators #210

sRam1404 opened this issue Jun 18, 2024 · 1 comment

Comments

@sRam1404
Copy link

Issue type: ❓ Question

This is a continuation of the issue #67 in my opinion.

I tried out the solution provided by @pheyvaer along with the sample data on that issue using Matey and the output linked data seems off and might not have been what the original poster was probably looking for. I was expecting ex:Smith_Bland to only be associated with ex:John, but the solution with the equal function does not seem the right match.

I would like to know if there are more examples and documentation for parsing nested JSON structures, because I clicked through a few of the examples inside /yarrrml-parser/test, but I don't know which might be the correct one to follow.

Also, I have seen the list of RMLMapper functions. Where can I look for examples of how these are used inside YARRRML?

Coming to the problem at hand, I have a nested JSON object that has the following structure and I would like to:

  • Get the following data under report-content and assign it to the data property of an instance of class Requirement.
    • id
    • requirement_text
    • priority
  • Get the data in the JSON path $.report_content[*].additional_identifiers[1] and continue to assign this information to the appropriate data property in the corresponding instance of class Requirement.
    • name
    • type
    • url

I would be grateful for your help and suggestions. Thanks in advance! :-)

{
    "report-content": [
        {
            "category": "requirement",
            "id": "REQ-001",
            "additional_identifiers": [
                {
                    "name": "PersonXYZ",
                    "type": "Customer Representative",
					"stakeholders": "EntityA"

                },
                {
                    "name": "Label for REQ-001",
                    "type": "Customer Requirement",
                    "url": "https://somelinkToRequirementsManagementTool.com"
                }
            ],
            "requirement_text": "This is a dummy requirement that is needed for some reason.",
            "priority": "High"
        },
        {
            "category": "requirement",
            "id": "REQ-002",
            "additional_identifiers": [
                {
                    "name": "PersonABC",
                    "type": "Customer Representative",
					"stakeholders": "EntityA, EntityB"
                },
                {
                    "name": "Label for REQ-002",
                    "type": "Customer Requirement",
                    "url": "https://somelinkToRequirementsManagementTool.com"
                }
            ],
            "requirement_text": "This is a dummy requirement that is needed for some reason.",
            "priority": "Medium"
        }
    ]
}
@sRam1404
Copy link
Author

An idea that is forming in my head is to use function nesting. First split the string data array within additional_identifiers, then find the second instance starting with name and get its value.
Is that a good approach? Or am I missing something very basic?

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant