Skip to content

Question on slash terms #165

@enginetix2

Description

@enginetix2

Hello,

Im in need of some help to search a dict I have. I can get to the first level but I cannot search any lower and I believe it due to some extra brackets in the dict.

Example:
import dpath.util dpath.util.get(workspaces, ['ldp:contains'])

Returns:

[[{'ldp:membershipResource': {'@id': '#bb95d8f4-fae4-490c-b764-4f83e3bba4f5'},
   '@type': ['ldp:DirectContainer', 'kerml:Workspace'],
   'ldp:contains': [{'@id': '272e28f2-45b7-45cb-a016-800ba747e716'}],
   'ldp:hasMemberRelation': 'kerml:resources',
   '@id': 'bb95d8f4-fae4-490c-b764-4f83e3bba4f5',
   '@context': 'https://18.205.77.131:8111/osmc/schemas/workspaceContainer'},
  {'@base': 'https://18.205.77.131:8111/workspaces/bb95d8f4-fae4-490c-b764-4f83e3bba4f5/resources',
   'createdDate': 1668544978,
   '@type': ['kerml:Workspace'],
   'modifiedDate': 1668545070,
   'dcterms:description': '',
   'dcterms:title': 'API Testing',
   '@id': '#bb95d8f4-fae4-490c-b764-4f83e3bba4f5',
   'kerml:resources': [{'@id': '272e28f2-45b7-45cb-a016-800ba747e716'}],
   '@context': 'https://18.205.77.131:8111/osmc/schemas/workspace'}],
 [{'ldp:membershipResource': {'@id': '#2d391e74-335e-47c0-9f61-4695604cf109'},
   '@type': ['ldp:DirectContainer', 'kerml:Workspace'],
   'ldp:contains': [{'@id': '55a6b90e-bb59-4e21-b63e-33868eb593dd'},
    {'@id': 'f8673e7d-6e5c-4dd6-b2ee-9ccb4987630c'}],
   'ldp:hasMemberRelation': 'kerml:resources',
   '@id': '2d391e74-335e-47c0-9f61-4695604cf109',
   '@context': 'https://18.205.77.131:8111/osmc/schemas/workspaceContainer'},
  {'@base': 'https://18.205.77.131:8111/workspaces/2d391e74-335e-47c0-9f61-4695604cf109/resources',
   'createdDate': 1658768772,
   '@type': ['kerml:Workspace'],
   'modifiedDate': 1659558366,
   'dcterms:description': '',
   'dcterms:title': 'Training Models',
   '@id': '#2d391e74-335e-47c0-9f61-4695604cf109',
   'kerml:resources': [{'@id': '55a6b90e-bb59-4e21-b63e-33868eb593dd'},
    {'@id': 'f8673e7d-6e5c-4dd6-b2ee-9ccb4987630c'}],
   '@context': 'https://18.205.77.131:8111/osmc/schemas/workspace'}],
   ...

Im looking to find the value of '@id': '#bb95d8f4-fae4-490c-b764-4f83e3bba4f5' (Line 1 of the returned dict) where 'dcterms:title' == 'API Testing', (Line 12 of the return). It seems like the initial [[ is causing an issue from all of the combinations I have tried.

Any feedback would be appreciated....
Regards,

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions