Skip to content
Mindey edited this page Nov 9, 2019 · 9 revisions

What is this?

This wiki serves as a main repository of specific schemas to be used by our group to work with data sources.

How to use this Wiki

If you have a data source, where you scraped an object, then extract its template using metaform.template( MYDATA ), and then specify the field definitions using our vocabulary.

Example

Data

Let's say you've got some data:

data = [
    {'a': 1, 'b': 'snack'},
    {'a': 2, 'b': 'cake'}
]

Schema

Just use metaform.template(data), to get:

[{'a': {'*': ''}, 'b': {'*': ''}, '*': ''}]

Then, specify what each field means, by providing its term from any vocabulary, via metawiki shortcuts, which includes all LOV too:

schema = {'a': {'*': 'GH:wefindx/terms/Price#exchange-eur-real1dpoint'},
  'b': {'*': 'GH:wefindx/terms/Meal#food-types-UnorderedSet'},
  '*': 'GH:wefindx/terms/Purchase'}

Normalization

import metaform
metaform.load(data).format(schema)
Clone this wiki locally