Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
lmichel opened this issue Sep 9, 2021 · 4 comments · Fixed by #15390
Closed

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

lmichel opened this issue Sep 9, 2021 · 4 comments · Fixed by #15390

Comments

@lmichel
Copy link
Contributor

lmichel commented Sep 9, 2021

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.

@github-actions
Copy link

github-actions bot commented Sep 9, 2021

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 feedback@astropy.org.

@pllim
Copy link
Member

pllim commented Sep 9, 2021

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

@lmichel
Copy link
Contributor Author

lmichel commented Mar 10, 2022

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.

@lmichel
Copy link
Contributor Author

lmichel commented Sep 26, 2023

This issue is solved by #15390

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

Successfully merging a pull request may close this issue.

2 participants