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

[API v1.0.0 Feedback] Consider adding more information to get_triples #90

Open
antaresc opened this issue Aug 14, 2019 · 1 comment
Open
Assignees
Labels
python api feedback Feedback for the Python Client API

Comments

@antaresc
Copy link
Contributor

Currently, datacommons.get_triples returns a list of 3-tuples like so.

('geoId/sch069112212709', 'schoolDistrict', 'geoId/sch0691122')
('geoId/sch069112210678', 'schoolDistrict', 'geoId/sch0691122')
('geoId/sch069112209271', 'schoolDistrict', 'geoId/sch0691122')
('geoId/sch069112206289', 'schoolDistrict', 'geoId/sch0691122')

Perhaps we can consider returning more information about the subject and object node such as:

  • The name
  • Whether or not the node is a reference
  • The type
@antaresc antaresc added the python api feedback Feedback for the Python Client API label Aug 14, 2019
@antaresc antaresc self-assigned this Aug 14, 2019
@antaresc
Copy link
Contributor Author

Potentially we can return the following format from get_triples:

Imagine calling get_triples(['geoId/06']) returns two triples: ('geoId/06', 'name', 'California') and ('geoId/06', 'containedInPlace', 'country/USA'). 

A potential format could be the following dictionary

{
    "geoId/06": [
        {
            "subject_id": "geoId/06",
            "property": "name",
            "object_value": "California" # To denote a non-reference node
        },
        {
            "subject_id": "geoId/06",
            "property": "containedInPlace",
            "object_id": "country/USA" # To denote a reference node
        }
    ]
}

Another format could be

{
    "geoId/06": [
        ("geoId/06", "name", "California", None), # Index 2 and 3 are reserved for the object node. 2 exists if it is a non-reference node.
        ("geoId/06", "containedInPlace", None, "country/USA") # 3 exists if it is a reference node
    ]
}

@antaresc antaresc added this to the API Release 1.1.0 milestone Aug 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
python api feedback Feedback for the Python Client API
Projects
None yet
Development

No branches or pull requests

2 participants