mivot-validator


Namemivot-validator JSON
Version 0.0.2 PyPI version JSON
download
home_pageNone
SummaryTools for validating VOTable annotated with MIVOT and to generate MIVOT snippets
upload_time2024-07-05 13:54:27
maintainerNone
docs_urlNone
authorNone
requires_python>=3.6
licenseMIT License Copyright (c) 2022 International Virtual Observatory Alliance Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords annotation data model ivoa mivot votable
VCS
bugtrack_url
requirements lxml xmlschema xmltodict astropy
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # mivot-validator

This package has 2 purposes:

- Validation of VOTables annotated with IVOA recommendation [MIVOT](https://ivoa.net/documents/MIVOT/20230620/index.html)
- MIVOT serialization of model components (snippets) that can be used to build annotations

## Installation

The validator is distributed as a Python package.

```bash
$ pip install mivot-validator
```

## Scripts for Validating Annotated VOTables

There are 2 validation levels:

- against the XML schemas (VOTable and MIVOT)
- against the model itself as it is defined in VODML

### XML Schema Validation

Validation of an annotated VOTable against both VOTable and MIVOT schemas:

```bash
$ mivot-validate  PROJECT_DIR/tests/data/gaia_3mags_ok_1.xml

USAGE: mivot-validate [path]
       Validate against both VOTable and MIVOT schemas
       path: either a simple file or a directory
             all directory XML files are validated
       exit status: 0 in case of success, 1 otherwise
```

Validation of an annotated VOTable against the MIVOT schema only:
    
```bash 
$ mivot-mapping-validate  PROJECT_DIR/tests/data/gaia_3mags_ok_1.xml 

USAGE: mivot-mapping-validate [path]
       Validate XML files against  MIVOT schema
       path: either a simple file or a directory
             all directory XML files are validated
       exit status: 0 in case of success, 1 otherwise
```

### Model Validation

This tool checks that mapped classes match the model they refer to. 

```bash 
$ mivot-instance-validate <VOTABLE path>
    
USAGE: mivot-instance-validate [path]
       Validate the mapped instances against the VODML definitions
       path: path to the mapped VOTable to be checked
       exit status: 0 in case of success, 1 otherwise
```

### Types and Roles Checking

The validation tool below checks that all `dmtype` and `dmrole` referenced in the mapping block 
are known by mapped models; it does not care of the class structures. 
This checking only works with the *PhotDM/MANGO/Meas/Coord/ivoa* models, other models are ignored.

```bash
$ types-and-roles-validate <VOTABLE path>
    
USAGE: types-and-roles-validate [path]
       Validate all dmtypes and dmroles
       exit status: 0 in case of success, 1 otherwise
```
       
## Snippet Generation

To facilitate the MIVOT annotation of VODML files, it can be convenient to work with 
pre-computed snippets that can be stacked to build full annotation blocks.

- A snippet is a MIVOT fragment, where values and references are not set, that represents a component of a model.
- Snippets can easily be derived from the VODML representation of the model as long as there is no class polymorphism.
  If there is some, we provide a tool helping users to resolve abstract components.

There are two snippet generators available in this package:
 
- `mivot-snippet-model` which allows, for a given model, to generate all 
   non-abstract object and data types as MIVOT components.
-  The `mivot-snippet-instance` which generate, for a given concrete class name, a 
   usable snippet including the concrete classes given either as user input or as command line parameters. 
       
### Build all MIVOT snippets for a model

```bash   
$ mivot-snippet-model [VODML path or url]
    
USAGE: mivot-snippet-model [path] [output_dir]
       Create MIVOT snippets from VODML files
       path: either a simple file to any VODML-Model or an ur
       output_dir: (optional) path to the chosen output directory (session working directory by default)
       exit status: 0 in case of success, 1 otherwise
```

### Build the MIVOT snippet for one model class with resolving abstract types:

```bash 
$ mivot-snippet-instance coords:TimeSys `pwd`/coords.TimeSys.example \
   -cc dmrole=coords:TimeFrame.refPosition,context=coords:TimeSys,dmtype=coords:RefLocation,class=coords:StdRefLocation\
   -cc dmrole=coords:TimeFrame.refDirection,context=coords:TimeSys,dmtype=coords:RefLocation,class=coords:StdRefLocation
```
    
In this example the tool will generate one snippet for the object type `coords:TimeSys`.

- The produced file will be located in `CURRENT_FOLDER/coords.TimeSys.example.xml`.
  If the output is not an absolute path, it will be located in the session working directory.
- All MIVOT instances of (abstract) type `coords:RefLocation` playing the role `coords:TimeFrame.refPosition`
  and hosted by a class playing the role `coords:TimeSys`, will be replaced by instances of type `coords:StdRefLocation`
- All MIVOT instances of (abstract) type `coords:RefLocation` playing the role `coords:TimeFrame.refDirection`
  and hosted by a class playing the role `coords:TimeSys`, will be replaced by instances of type `coords:StdRefLocation`

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mivot-validator",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "annotation, data model, ivoa, mivot, votable",
    "author": null,
    "author_email": "Laurent Michel <laurent.michel@astro.unistra.fr>",
    "download_url": "https://files.pythonhosted.org/packages/54/9b/eb733bbfb2b976cb3befda10f15fef60e8938eeb6fb6439687891cc715d0/mivot_validator-0.0.2.tar.gz",
    "platform": null,
    "description": "# mivot-validator\n\nThis package has 2 purposes:\n\n- Validation of VOTables annotated with IVOA recommendation [MIVOT](https://ivoa.net/documents/MIVOT/20230620/index.html)\n- MIVOT serialization of model components (snippets) that can be used to build annotations\n\n## Installation\n\nThe validator is distributed as a Python package.\n\n```bash\n$ pip install mivot-validator\n```\n\n## Scripts for Validating Annotated VOTables\n\nThere are 2 validation levels:\n\n- against the XML schemas (VOTable and MIVOT)\n- against the model itself as it is defined in VODML\n\n### XML Schema Validation\n\nValidation of an annotated VOTable against both VOTable and MIVOT schemas:\n\n```bash\n$ mivot-validate  PROJECT_DIR/tests/data/gaia_3mags_ok_1.xml\n\nUSAGE: mivot-validate [path]\n       Validate against both VOTable and MIVOT schemas\n       path: either a simple file or a directory\n             all directory XML files are validated\n       exit status: 0 in case of success, 1 otherwise\n```\n\nValidation of an annotated VOTable against the MIVOT schema only:\n    \n```bash \n$ mivot-mapping-validate  PROJECT_DIR/tests/data/gaia_3mags_ok_1.xml \n\nUSAGE: mivot-mapping-validate [path]\n       Validate XML files against  MIVOT schema\n       path: either a simple file or a directory\n             all directory XML files are validated\n       exit status: 0 in case of success, 1 otherwise\n```\n\n### Model Validation\n\nThis tool checks that mapped classes match the model they refer to. \n\n```bash \n$ mivot-instance-validate <VOTABLE path>\n    \nUSAGE: mivot-instance-validate [path]\n       Validate the mapped instances against the VODML definitions\n       path: path to the mapped VOTable to be checked\n       exit status: 0 in case of success, 1 otherwise\n```\n\n### Types and Roles Checking\n\nThe validation tool below checks that all `dmtype` and `dmrole` referenced in the mapping block \nare known by mapped models; it does not care of the class structures. \nThis checking only works with the *PhotDM/MANGO/Meas/Coord/ivoa* models, other models are ignored.\n\n```bash\n$ types-and-roles-validate <VOTABLE path>\n    \nUSAGE: types-and-roles-validate [path]\n       Validate all dmtypes and dmroles\n       exit status: 0 in case of success, 1 otherwise\n```\n       \n## Snippet Generation\n\nTo facilitate the MIVOT annotation of VODML files, it can be convenient to work with \npre-computed snippets that can be stacked to build full annotation blocks.\n\n- A snippet is a MIVOT fragment, where values and references are not set, that represents a component of a model.\n- Snippets can easily be derived from the VODML representation of the model as long as there is no class polymorphism.\n  If there is some, we provide a tool helping users to resolve abstract components.\n\nThere are two snippet generators available in this package:\n \n- `mivot-snippet-model` which allows, for a given model, to generate all \n   non-abstract object and data types as MIVOT components.\n-  The `mivot-snippet-instance` which generate, for a given concrete class name, a \n   usable snippet including the concrete classes given either as user input or as command line parameters. \n       \n### Build all MIVOT snippets for a model\n\n```bash   \n$ mivot-snippet-model [VODML path or url]\n    \nUSAGE: mivot-snippet-model [path] [output_dir]\n       Create MIVOT snippets from VODML files\n       path: either a simple file to any VODML-Model or an ur\n       output_dir: (optional) path to the chosen output directory (session working directory by default)\n       exit status: 0 in case of success, 1 otherwise\n```\n\n### Build the MIVOT snippet for one model class with resolving abstract types:\n\n```bash \n$ mivot-snippet-instance coords:TimeSys `pwd`/coords.TimeSys.example \\\n   -cc dmrole=coords:TimeFrame.refPosition,context=coords:TimeSys,dmtype=coords:RefLocation,class=coords:StdRefLocation\\\n   -cc dmrole=coords:TimeFrame.refDirection,context=coords:TimeSys,dmtype=coords:RefLocation,class=coords:StdRefLocation\n```\n    \nIn this example the tool will generate one snippet for the object type `coords:TimeSys`.\n\n- The produced file will be located in `CURRENT_FOLDER/coords.TimeSys.example.xml`.\n  If the output is not an absolute path, it will be located in the session working directory.\n- All MIVOT instances of (abstract) type `coords:RefLocation` playing the role `coords:TimeFrame.refPosition`\n  and hosted by a class playing the role `coords:TimeSys`, will be replaced by instances of type `coords:StdRefLocation`\n- All MIVOT instances of (abstract) type `coords:RefLocation` playing the role `coords:TimeFrame.refDirection`\n  and hosted by a class playing the role `coords:TimeSys`, will be replaced by instances of type `coords:StdRefLocation`\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2022 International Virtual Observatory Alliance  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Tools for validating VOTable annotated with MIVOT and to generate MIVOT snippets",
    "version": "0.0.2",
    "project_urls": {
        "Homepage": "https://github.com/ivoa/mivot-validator"
    },
    "split_keywords": [
        "annotation",
        " data model",
        " ivoa",
        " mivot",
        " votable"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "5784914381dd50093858c1e8ae3c44ac0f7ce9ab5f552369191c5b0618fae9d8",
                "md5": "6d5439dfea3c12a5728e440b1eb67738",
                "sha256": "fe122bb8e458e2deff4452d134d6e835fe56e9715247665c67fdb46a2f4b1b80"
            },
            "downloads": -1,
            "filename": "mivot_validator-0.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6d5439dfea3c12a5728e440b1eb67738",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 178715,
            "upload_time": "2024-07-05T13:54:25",
            "upload_time_iso_8601": "2024-07-05T13:54:25.556190Z",
            "url": "https://files.pythonhosted.org/packages/57/84/914381dd50093858c1e8ae3c44ac0f7ce9ab5f552369191c5b0618fae9d8/mivot_validator-0.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "549beb733bbfb2b976cb3befda10f15fef60e8938eeb6fb6439687891cc715d0",
                "md5": "e49f21a29f4c3e46f39f630e7e766cda",
                "sha256": "c6888fce48b04122135a955ef6db4f57b322778922f22e86b494ddcf6ca59b90"
            },
            "downloads": -1,
            "filename": "mivot_validator-0.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "e49f21a29f4c3e46f39f630e7e766cda",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 220444,
            "upload_time": "2024-07-05T13:54:27",
            "upload_time_iso_8601": "2024-07-05T13:54:27.256622Z",
            "url": "https://files.pythonhosted.org/packages/54/9b/eb733bbfb2b976cb3befda10f15fef60e8938eeb6fb6439687891cc715d0/mivot_validator-0.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-07-05 13:54:27",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ivoa",
    "github_project": "mivot-validator",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "lxml",
            "specs": []
        },
        {
            "name": "xmlschema",
            "specs": []
        },
        {
            "name": "xmltodict",
            "specs": []
        },
        {
            "name": "astropy",
            "specs": []
        }
    ],
    "lcname": "mivot-validator"
}
        
Elapsed time: 0.25820s