""" ontology.py
Copyright (C) 1999 Aloril
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
"""
from panlingua import *
o=semnet
def add_link(fr,type,to,weight=1.0):
semlink(fr,type,to,weight,o)
add_link("#breakfast_verb1","isa","#eat_verb2")
add_link("#lunch_verb1","isa","#eat_verb2")
add_link("#sup_verb1","isa","#eat_verb2")
def get_isa(id):
res=[]
if not o.has_key(id): return res
s=o[id]
res.append(s)
for l in s.semlinks:
if l.type=='isa' and l.fr==s:
res=res+get_isa(l.to.id)
return res
               (
geocities.com/siliconvalley/station/4279)                   (
geocities.com/siliconvalley/station)                   (
geocities.com/siliconvalley)