frictionlessdata / datapackage-php

A php library for working with Data Package.
MIT License
10 stars 10 forks source link

Resource object should support additional properties/methods: local, remote, inline, multipart, tabular, source #23

Open OriHoch opened 7 years ago

OriHoch commented 7 years ago

see the implementation docs: https://github.com/frictionlessdata/implementations#datapackage

roll commented 7 years ago

Related to this issue:

Iterating or reading over the resource produces combined rows from all the path or data elements

foreach ($resource as $row) {};  // iterating
$resource->read();  // get all the data as an array

Not sure what's $resource->read() current behavior related to tabular/non-tabular resources. In other implementations we just expose Table API for tabular resources via resource.table.

roll commented 7 years ago

@OriHoch Also I think may it will be nicer instead of resource.source_type to expose following flags:

It will be logical continuation for resource.tabular flag, field.required flag etc

cc @georgiana-b

roll commented 7 years ago

So yes that's how (using boolean flags) now it's implemented in Python, JavaScript and Ruby:

resource.local
resource.remote
resource.inline
resource.multipart
resource.tabular

And alias for descriptor.data/path:

resource.source