Skip to main content

A generator for Field Definitions for ResearchSpace and Metaphacts

Project description

SARI Field Definitions Generator

A generator for Metaphacts/ResearchSpace field definitions

Installations

install using pip

pip install sari-field-definitions-generator

Usage

Define field definitions as a Python dict or in an external yaml file:

prefix: http://rs.swissartresearch.net/instances/fields/

fields:

    - id: {unique identifier}
      label: {label}
      description: {description}
      dataType: {datatype}
      domain: {domain}
      range: {range}
      minOccurs: #
      maxOccurs: #
      queries:
        - ask: '{ask query}'
        - delete: '{delete query}'
        - insert: '{insert query}'
        - select: '{select query}'
        - valueSet: '{value set query}'

    - ...

Then, load and compile it using the generator

from sariFieldDefinitionsGenerator import generator

inputFile = './fieldDefinitions.yml'
outputFile = '../ldp/assets/fieldDefinitions.trig'

model = generator.loadSourceFromFile(inputFile)

output = generator.generate(model, generator.METAPHACTS)

with open(outputFile, 'w') as f:
    f.write(output)

Available templates are:

  • generator.METAPHACTS for Metaphacts Open Source Platform
  • generator.RESEARCHSPACE for ResearchSpace
  • generator.UNIVERSAL for both platforms
  • generator.JSON for a JSON representation
  • generator.INLINE for a Backend Template version

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page