Package gavo :: Package protocols :: Module datalink :: Class LinkDef
[frames] | no frames]

Class LinkDef

source code

object --+
         |
        LinkDef

A definition of a datalink related document.

These are constructed at least with:

In addition, we accept the remaining column names from //datalink#dlresponse as keyword arguments.

In particular, do set semantics with a term from http://www.ivoa.net/rdf/datalink/core. This includes #this, #preview, #calibration, #progenitor, #derivation

Instance Methods
 
__init__(self, pubDID, accessURL, serviceType=None, errorMessage=None, description=None, semantics='http://dc.g-vo.org/datalink#other', contentType=None, contentLength=None)
x.__init__(...) initializes x; see help(type(x)) for signature
source code
 
asDict(self)
returns the link definition in a form suitable for ingestion in //datalink#dlresponse.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Methods
 
fromFile(cls, localPath, description, semantics, service, contentType=None, suppressMissing=False)
constructs a LinkDef based on a local file.
source code
Properties

Inherited from object: __class__

Method Details

__init__(self, pubDID, accessURL, serviceType=None, errorMessage=None, description=None, semantics='http://dc.g-vo.org/datalink#other', contentType=None, contentLength=None)
(Constructor)

source code 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

fromFile(cls, localPath, description, semantics, service, contentType=None, suppressMissing=False)
Class Method

source code 

constructs a LinkDef based on a local file.

You must give localPath (which may be resdir-relative), description and semantics are mandatory. ContentType and contentSize will normally be determined by DaCHS.

You must also pass in the service used to retrieve the file. This must allow the static renderer and have a staticData property. It should normally be the datalink service itself, which in a metaMaker is accessible as self.parent.parent. It is, however, legal to reference other suitable services (use self.parent.rd.getById or base.resolveCrossId)

If you pass suppressMissing=True, a link to a non-existing file will be skipped rather than create a missing datalink.