Changeset 3070


Ignore:
Timestamp:
29/11/07 11:03:23 (12 years ago)
Author:
lawrence
Message:

Support for synonyms in semantic search

Location:
TI05-delivery/ows_framework/trunk/ows_server/ows_server
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/controllers/discovery.py

    r3069 r3070  
    295295        vs=VS(proxyServer=self.cf.get('DEFAULT','proxyServer')) 
    296296        if 'searchString' in self.inputs: 
    297             [broader,narrower]=vs.getRelated(self.inputs['searchString']) 
    298             c.narrower=narrower 
    299             c.broader=broader 
     297            [broader,narrower,synonyms]=vs.getRelated(self.inputs['searchString']) 
    300298            #get a base string for the links to new searches 
    301299            if 'start' in self.inputs: del self.inputs['start'] 
     
    308306            c.narrower=[] 
    309307            c.broader=[] 
     308            c.synonyms=[] 
    310309            for i in narrower: 
    311310                c.narrower.append((i,url.replace('###SEARCHSSTRING###',i))) 
    312311            for i in broader: 
    313312                c.broader.append((i,url.replace('###SEARCHSSTRING###',i))) 
     313            for i in synonyms: 
     314                c.synonyms.append((i,url.replace('###SEARCHSSTRING###',i))) 
     315            if c.narrower!=[] or c.broader!=[] or c.synonyms!=[]: c.semAvailable=1 
    314316        else: 
    315             broader,narrower=[],[] 
     317            broader,narrower,synonyms=[],[],[] 
     318            c.semAvailable=0 
    316319         
    317320        return render_response('semantic',fragment=True) 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/models/DocumentRetrieve.py

    r3069 r3070  
    188188        b=x.findall('*/{urn:vocab/types}broadMatch') 
    189189        n=x.findall('*/{urn:vocab/types}narrowMatch') 
     190        s=x.findall('*/{urn:vocab/types}exactMatch') 
    190191        self.broader=[(i.find('{urn:vocab/types}entryTerm').text or '') for i in b] 
    191192        self.narrower=[(i.find('{urn:vocab/types}entryTerm').text or '') for i in n] 
    192         return [self.broader,self.narrower] 
     193        self.synonyms=[(i.find('{urn:vocab/types}entryTerm').text or '') for i in s] 
     194        return [self.broader,self.narrower,self.synonyms] 
  • TI05-delivery/ows_framework/trunk/ows_server/ows_server/templates/semantic.kid

    r3069 r3070  
    22    <body> 
    33        <div id="SemanticSearchResults"> 
    4             <span py:if="c.narrower!=[] or c.broader!=[]">You could also try </span> 
     4            <span py:if="c.semAvailable">You could also try - </span> 
     5            <span py:if="c.synonyms !=[]">  
     6                synonym(s): <span py:for="i,url in c.synonyms"><a href="$url">$i</a>&nbsp;</span> 
     7                <span py:if="c.narrower!=[] or c.broader!=[]">;</span> 
     8            </span> 
    59            <span py:if="c.narrower !=[]">  
    610                narrower search(s): <span py:for="i,url in c.narrower"><a href="$url">$i</a>&nbsp;</span> 
     11                <span py:if="c.broader!=[]">;</span> 
    712            </span> 
    8             <span py:if="c.narrower !=[] and c.broader!=[]">;</span> 
    913            <span py:if="c.broader !=[]">  
    1014                broader search(s): <span py:for="i,url in c.broader"><a href="$url">$i</a>&nbsp;</span> 
    11             </span> 
    12             <span py:if="c.narrower==[] and c.broader==[]">No alternatives available</span> 
     15            </span>. 
     16            <span py:if="not c.semAvailable">No alternatives available</span> 
    1317        </div> 
    1418    </body> 
Note: See TracChangeset for help on using the changeset viewer.