Skip to content

Commit

Permalink
upgrade to new schema with VODML_REF iso UTYPE
Browse files Browse the repository at this point in the history
upgrade schema, bindings, pyxb version (1.2.4).
Remove occurrences of 'utype' in the code and README.
upgrade vodml/xml files
  • Loading branch information
olaurino committed Apr 18, 2015
1 parent 9ee92f2 commit 6f45eb3
Show file tree
Hide file tree
Showing 16 changed files with 1,991 additions and 3,283 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,20 +64,20 @@ code describing the IVOA description is built-in in VOLIB, since it contains the
to Python native ones).

If installed (or Development mode is on), the `reference` package registers some `setuptools` EntryPoints that are
used by the VOLIB framework to dynamically load Python objects corresponding to specific UTYPEs.
used by the VOLIB framework to dynamically load Python objects corresponding to specific VODML_REFs.

You can test this demo package with:

$ python setup.py develop

For instance, you can get the path to the class corresponding to the SkyCoordinate UTYPE in the Reference Data Model
For instance, you can get the path to the class corresponding to the SkyCoordinate VODML_REF in the Reference Data Model
by querying volib as follows:

$ python
>>> import volib
>>> from volib import utypes
>>> utype = utypes.UTYPE('ref:source.stc.SkyCoordinate')
>>> volib.resolve(utype, '1.0')
>>> from volib import vodml_ref
>>> vodml_ref = vodml_ref.VODML_REF('ref:source.stc.SkyCoordinate')
>>> volib.resolve(vodml_ref, '1.0')
'ref_1_0.source.stc.SkyCoordinate'

The above code queries volib for the full path of the class representing the `SkyCoordinate` Type defined in the
Expand All @@ -86,13 +86,13 @@ Reference Data Model *version 1.0* inside the `stc` package, which is in turn a
Note that different versions of the same package can be installed at the same time.

In order to get a hold on the actual Python class (or any other Python object representing the element pointed to
by a given UTYPE), you can use the `get_object` function:
by a given VODML_REF), you can use the `get_object` function:

>>> volib.get_object(utype, '1.0')
>>> volib.get_object(vodml_ref, '1.0')
<class 'reference.ref_1_0.source.stc.SkyCoordinate'>

An higher level API can be used to get a `Context` that caches the values of the versions so that a client can
resolve `utypes` strings only. For example:
resolve `vodml_refs` strings only. For example:

>>> from collections import namedtuple
>>> Model = namedtuple('Model', ('name', 'version'))
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pyxb==1.2.3
pyxb==1.2.4
networkx
furl
jinja2
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def run_tests(self):
'furl',
'jinja2',
'networkx',
'pyxb==1.2.3',
'pyxb==1.2.4',
],
tests_require=[
'pytest-cov',
Expand Down
4 changes: 2 additions & 2 deletions volib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

__all__ = ['Resolver', 'resolvers', 'resolve', 'add_resolver', 'vodml', 'get_object', 'Context', 'get_context']

import utypes
import vodml_ref

def utype_factory(utype):
if isinstance(utype, basestring):
utype = utypes.UTYPE(utype)
utype = vodml_ref.VODML_REF(utype)
return utype


Expand Down
12 changes: 6 additions & 6 deletions volib/generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import imp

import volib
from volib import vodml, utypes
from volib import vodml, vodml_ref


logging.basicConfig()
Expand Down Expand Up @@ -40,11 +40,11 @@ def alpha(string):
return _nonalpha.sub(r'_', string)


def resolve(utype_string, meta, model):
utype = utypes.UTYPE(utype_string)
version = meta.import_dict[utype.prefix]
ret = volib.resolve(utype, version)
if model and utype.prefix == model.name:
def resolve(vodml_ref_string, meta, model):
vodmlref = vodml_ref.VODML_REF(vodml_ref_string)
version = meta.import_dict[vodmlref.prefix]
ret = volib.resolve(vodmlref, version)
if model and vodmlref.prefix == model.name:
ret = ret.replace('%s_%s' % (pythonify(model.name), pythonify(model.version))+'.', '')
tokens = ret.split(model.name+'.')
if len(tokens) > 1:
Expand Down
114 changes: 57 additions & 57 deletions volib/resources/CharDM-proto.vodml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,163 +6,163 @@
<author>Gerard Lemson</author>
<author>Laurent Bourges</author>
<version>proto</version>
<lastModified>2013-05-08T16:45:32</lastModified>
<lastModified>2015-04-18T16:45:32</lastModified>
<import>
<name>ivoa</name>
<version>proto</version>
<url>file:IVOA-proto.vodml.xml</url>
<documentationURL>http://volute.googlecode.com/svn/trunk/projects/dm/vo-dml/models/ivoa/IVOA.html
</documentationURL>
</import>
<objectType>
<vodml-id>Access</vodml-id>
<name>Access</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>

<dataType>
<vodml-id>Bounds</vodml-id>
<name>Bounds</name>
<description>Could be datatype</description>
<attribute>
<vodml-id>Access.reference</vodml-id>
<name>reference</name>
<description>uri to the effective transmission curve
NB this description applies to the inherited access atttribute on TransmissionCurve, not really to the
one on the base class.
<vodml-id>Bounds.extent</vodml-id>
<name>extent</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<datatype>
<utype>ivoa:string</utype>
<vodml-ref>ivoa:quantity.RealQuantity</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>1</minOccurs>
<minOccurs>0</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
<attribute>
<vodml-id>Access.format</vodml-id>
<name>format</name>
<vodml-id>Bounds.start</vodml-id>
<name>start</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<datatype>
<utype>ivoa:string</utype>
<vodml-ref>ivoa:quantity.RealQuantity</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>1</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
<attribute>
<vodml-id>Access.size</vodml-id>
<name>size</name>
<vodml-id>Bounds.stop</vodml-id>
<name>stop</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<datatype>
<utype>ivoa:nonnegativeInteger</utype>
<vodml-ref>ivoa:quantity.RealQuantity</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>0</minOccurs>
<minOccurs>1</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
</objectType>


</dataType>
<dataType>
<vodml-id>Bounds</vodml-id>
<name>Bounds</name>
<vodml-id>Location</vodml-id>
<name>Location</name>
<description>Could be datatype</description>
<attribute>
<vodml-id>Bounds.extent</vodml-id>
<vodml-id>Location.value</vodml-id>
<name>extent</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<datatype>
<utype>ivoa:quantity.RealQuantity</utype>
<vodml-ref>ivoa:quantity.RealQuantity</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>0</minOccurs>
<minOccurs>1</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
</dataType>
<dataType>
<vodml-id>Coverage</vodml-id>
<name>Coverage</name>
<description>Could be datatype</description>
<attribute>
<vodml-id>Bounds.start</vodml-id>
<name>start</name>
<vodml-id>Coverage.location</vodml-id>
<name>extent</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<datatype>
<utype>ivoa:quantity.RealQuantity</utype>
<vodml-ref>char:Location</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>1</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
<attribute>
<vodml-id>Bounds.stop</vodml-id>
<name>stop</name>
<vodml-id>Coverage.bounds</vodml-id>
<name>start</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<datatype>
<utype>ivoa:quantity.RealQuantity</utype>
<vodml-ref>char:Bounds</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>1</minOccurs>
<minOccurs>0</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
</dataType>
<dataType>
<vodml-id>Location</vodml-id>
<name>Location</name>
<description>Could be datatype</description>

<objectType>
<vodml-id>Access</vodml-id>
<name>Access</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<attribute>
<vodml-id>Location.value</vodml-id>
<name>extent</name>
<description>
TODO : Missing description : please, update your UML model asap.
<vodml-id>Access.reference</vodml-id>
<name>reference</name>
<description>uri to the effective transmission curve
NB this description applies to the inherited access atttribute on TransmissionCurve, not really to the
one on the base class.
</description>
<datatype>
<utype>ivoa:quantity.RealQuantity</utype>
<vodml-ref>ivoa:string</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>1</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
</dataType>
<dataType>
<vodml-id>Coverage</vodml-id>
<name>Coverage</name>
<description>Could be datatype</description>
<attribute>
<vodml-id>Coverage.location</vodml-id>
<name>extent</name>
<vodml-id>Access.format</vodml-id>
<name>format</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<datatype>
<utype>char:Location</utype>
<vodml-ref>ivoa:string</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>1</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
<attribute>
<vodml-id>Coverage.bounds</vodml-id>
<name>start</name>
<vodml-id>Access.size</vodml-id>
<name>size</name>
<description>
TODO : Missing description : please, update your UML model asap.
</description>
<datatype>
<utype>char:Bounds</utype>
<vodml-ref>ivoa:nonnegativeInteger</vodml-ref>
</datatype>
<multiplicity>
<minOccurs>0</minOccurs>
<maxOccurs>1</maxOccurs>
</multiplicity>
</attribute>
</dataType>
</objectType>
</vo-dml:model>

0 comments on commit 6f45eb3

Please sign in to comment.