How to create relation-type from PIMO ONTOLOGY through shell?
<p>We have created objecttype through the following:</p>

<p>def create_object_type(otname):
    obtype=Objecttype.objects.all()
    for i in obtype:
        otlist.append(str(i.title))
    if not otname in otlist:
        slu=slugify(otname)
        dict={'title':otname,'content':'','slug':slu,'status':2}
        ot=Objecttype.objects.create(**dict)
        ot.sites.add(Site.objects.get_current())
        ot.save()<br>
        gd=Objecttype.objects.get(title=otname)</p>

<p>create_object_type(otname)</p>

<p>Some of our ObjectType consist of:</p>

<p>'Location',
 'Agent',
 'Property',
 'PersonalInformationModel',
 'PersonalInformationModel',
 'Thing',</p>

<p>So now we want to create a relationtype of particular objecttype &amp; the code for that is:-</p>

<p>def create_relation_type(rtname,irname,lottype,rottype,lc,rc):
    lo=Objecttype.objects.get(title=lottype)
    loid=NID.objects.get(id=lo.id)
    ro=Objecttype.objects.get(title=rottype)
    roid=NID.objects.get(id=ro.id)
    dict={'title':rtname,'inverse':irname,'slug':rtname,'left_subjecttype_id':loid.id,'right_subjecttype_id':roid.id,'left_cardinality':lc,'right_cardinality':rc}
    rt=Relationtype.objects.create(**dict)
    rt.sites.add(Site.objects.get_current())
    rt.save()
    gd=Relationtype.objects.get(title=rtname)
    print 'The Relation type created was ',gd</p>

<p>So now how do i fetch rtname,irname,loid.id,roid.id,lc,rc given that i create list containing relationtype &amp; my problem lies firstly how do i get the loid.in and roid.id and then how do i link them with the object types to create a schema.</p>

<p>please if any one could help me out with this</p>

<p>thank you...</p>
