Skip to content

Accessing to the raw content of astropy.io.votable.tree.Resource(s) #12153

Closed

Description

@lmichel

Description

In the frame of the VO data modeling efforts, we have been planning to annotate VOTable resources with data model meta-data.

These annotations are XML pieces matching a specific schema independent of the VOTable schema. An annotated VOTable (work in progress) can be seen here (branch votable-schema)

Annotations are not intended to be consumed by Astropy but rather by some affiliated package. Anyway, astropy.io.votable must be enabled to provide access to that XML for any end-client.

In order to avoid to modify the current VOTable schema, these annotations will be enclosed in a Resource of type meta with a specific name space:

 <VOTable>
     <RESOURCE type=result>
         <RESOURCE type=meta>
             <dm-mapping:VODML ... My DM stuff ....>
        </RESOURCE>
       <TABLE/>       
       <TABLE/>
     </RESOURCE>
</VOTABLE>

This approach has been validated with regular XML parsers and validators and we need Astropy to support this new VOTable feature.
For this, theastropy.io.votable API must be able to extract the content of such resources. This is apparently not possible yet.

The new endpoint should look like:

votable = parse(votable_path)
   for resource in votable.resources:
       if resource.type == "results":
           for sub_resource in resource.resources:
               if sub_resource.type == "meta":
                   print("Here is my DM stuff")
                   annotation_content = sub_resource.content()

The resource content might be delivered as a DOM or/and as a string. The latest would allow final clients to run their own XML processors.

Activity

  1. github-actions commented on Sep 9, 2021

    @github-actions
    Contributor

    Welcome to Astropy 👋 and thank you for your first issue!

    A project member will respond to you as soon as possible; in the meantime, please double-check the guidelines for submitting issues and make sure you've provided the requested details.

    If you feel that this issue has not been responded to in a timely manner, please leave a comment mentioning our software support engineer @embray, or send a message directly to the development mailing list. If the issue is urgent or sensitive in nature (e.g., a security vulnerability) please send an e-mail directly to the private e-mail [email protected].

  2. pllim commented on Sep 9, 2021

    @pllim
    Member

    @tomdonaldson , I remember you said on Slack that you are interested in tackling this, is that still true? 😸

  3. lmichel commented on Mar 10, 2022

    @lmichel
    ContributorAuthor

    I've been prototyping this feature on my fork with a read/write working example.

    Our guideline (@tomdonaldson and myself) is that the piece of XML we need to work with (the model mapping block) must be extracted by the VOTable parser (tree.py) in a safe way, but it is not meant to by used by any Astropy function, VO data models being quite far from the Astropy core business. AstroPy is just an agnostic provider in this case.

    I enabled tree.py to extract all XML elements contained in the Resource@type=meta; these elements are serialized as a string that can be provided with a specific getter.

    • There no syntax validation but the element names.
    • This is consistent with the requirement that errors in the mapping must not break the VOTable validity.
      I've also implemented the reverse operation for writing model mapping blocks in VOtables.

    I'm fully aware that this post must be opaque to people not connected with the VO DM discussion and I'm ready to answer any question.
    However, I would appreciate if someone could tell me whether my way to proceed is correct or no.

  4. lmichel commented on Sep 26, 2023

    @lmichel
    ContributorAuthor

    This issue is solved by #15390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions