[RDF] Mail sent to rdfapi_perl@yahoogroups.com

Jonas Liljegren jonas@liljegren.org
01 Jun 2001 19:55:22 +0200


Hi.  This is jonas, the man behind the incomperhincible project Wraf. ;)

Well. It works. But it need more work until it can be viewed as useful.

The demo uses Template Toolkit. (The best template system for perl! ;)
        http://www.tt2.org/


This is a simplified template listing a selected person. (I removed
all exception handling from the template.):



[% person =3D s.get(cgi.param('r_person')) %]

<h2>
  [% person.fn.li.value %]
  [% person.ln.li.value %]
</h2>

<dl>
[% FOREACH pred =3D person.arc_pred.list %]
  <dt>[% pred.desig %]</dt>
  <dd>
    <ol>
    [% FOREACH arc =3D person.arc(pred).list %]
      <li>$arc.obj.desig
        <ul>
          <li>
            Date: [% arc.model.updated.li.value %]
          </li>
          <li>Agent:=20
            [% agent =3D arc.model.agent.li %]
            [% agent.fn.li.value %]
            [% agent.ln.li.value %]
          </li>
        </ul>
      </li>
    [% END %]
    </ol>
  </dd>
[% END %]
</dl>


---

And here is a link directly to the demo for this page:
        http://uxn.nu/wraf/RDF-Service/demo/pers1/cgi-bin/client.cgi?r_pers=
on=3Dhttp%3A%2F%2Fuxn.nu%2Frdf%2F2000%2F09%2F19%2Flocal-data%2320010523T183=
615-001&handler=3Dperson_view

But the entry to the demo is here:
        http://uxn.nu/wraf/RDF-Service/demo/pers1/cgi-bin/demo.html

The subject of cachning is at the heart of Wraf. Then it's done, most
things should go much faster.


The 'fn' and 'ln'=A0above are abbrevations. Set up before parsing the
template. NS_LD is a constant holding the URI of the local namespace.

	$session_res->set_abbrev(
	    {
		fn  	     =3D> NS_LD.'Person/first_name',
		ln  	     =3D> NS_LD.'Person/last_name',
            }


This is a function for giving a resource some properties. In this
case, its the first and last name entered in a HTML form:

sub do_person_add
{
    my $model =3D $s;

    my $person =3D $model->get();

    my $r_fn =3D $q->param('r_fn') or die "No first name specified";
    my $r_ln =3D $q->param('r_ln') or die "No last name specified";

    my $types =3D [NS_LD.'Class#Person'];
    my $props =3D
    {
	NS_LD.'Property#first_name' =3D> [\$r_fn],
	NS_LD.'Property#last_name'  =3D> [\$r_ln],
    };

    $person->set( $types, $props );

    return "Person created";
}


And this is from another test program. It's a page for viewing a
search result. The search is specified as a DAML class.  the search
restrictions are class restrictions:

[% query =3D s.get(cgi.param('focus')) %]

<table>
[% FOREACH object =3D query.rev_type.list %]
  <tr>
      <td><a href=3D"$me?handler=3Dlodging_object&focus=3D
            [%- object.uri | uri %]">
            [%- object.label.li.value %]</a>
  </tr>=20
[% END %]
</table>




Wraf is something of the dream of the ultimate limitless computer
system.  Read more about it here:

        http://uxn.nu/wraf/

--=20
/ Jonas  -  http://jonas.liljegren.org/myself/en/index.html