Ignore:
Timestamp:
06/02/07 21:37:04 (13 years ago)
Author:
lawrence
Message:

Oops missed this from the previous discovery/browse commitals.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TI07-MOLES/trunk/PythonCode/wsgi/DocumentRetrieve.py

    r2097 r2120  
    55# The MOLES document retrieval is a python port of : 
    66# TI07-MOLES/trunk/JavaCode/returnmolesxmldb/ndg/services/returnmoles/Main.java 
     7# Note that ndgRetreive essentially provides test cases for this code. 
    78 
    89def queryReplace(xquery,repository,localID,targetCollection): 
     
    1516class DocumentRetrieve (ndg_eXist): 
    1617    ''' This class provides a document retrieval service via the NDG exist interfaces ''' 
    17  
    1818    def __init__(self,repository): 
    1919 
     
    2323    def get(self,repository,schema,localID,format='NDG-B0',targetCollection='/db/discovery/moles'): 
    2424 
    25         # we are making the assumption for now that everything is stored as  
     25        # We are making the assumption for now that everything is stored as  
    2626        # MOLES documents and that we can retrieve from MOLES anything we like 
    2727        # in another format. 
     
    5050             
    5151            if hits!=1: raise ValueError,'%s documents returned for uri %s:%s:%s'%(hits,repository,'NDG-B0',localID) 
    52              
     52             
    5353            # check output formats 
    5454            allowed = ['DIF','DC','ISO19115','NDG-B0','NDG-B1'] 
     
    9797        self.sessionRelease(id) 
    9898        return r 
     99             
     100    def getOriginal(self,docName): 
     101        ''' Get a specific document from the originals collection collection ''' 
     102 
     103        #xquery='''let $doc := collection('%s')//root()[util:document-name(.) = '%s' ]  
     104        #          for $i in $doc return <document>{document-uri($i)}</document>'''%(collection,docName) 
     105        # 
     106        #id,summary=self.executeQuery(xquery) 
     107        #hits=summary['hits'] 
     108        #if hits!=1: raise ValueError,'%s original documents returned for uri %s'%(hits,docName) 
     109        #r=self.retrieve(id,0,{}) 
     110        #self.sessionRelease(id) 
     111        #return r 
     112         
     113        from ndgSearch import ndgSearch 
     114        ndgWS=ndgSearch() 
     115        result=ndgWS.getDoc(docName+'.xml') 
     116        return result 
    99117         
    100  
    101          
Note: See TracChangeset for help on using the changeset viewer.