[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Debian-sf-devel] Fwd: example librdf wrapping
From: |
James Michael DuPont |
Subject: |
[Debian-sf-devel] Fwd: example librdf wrapping |
Date: |
Mon, 9 Dec 2002 02:31:42 -0800 (PST) |
I have now a librdf php4 module,
thanks to Christians help. Only problem is the FILE handles,
any idea how to get a File : SWIGTYPE_p_FILE ?
in the C function it is :
int librdf_serializer_serialize_model(librdf_serializer* serializer,
FILE *handle, librdf_uri* base_uri, librdf_model* model);
I think that maybe this RDF would make a good plugin as well? What is
the minimum for creating such plugins?
mike
--- James Michael DuPont <address@hidden> wrote:
> From James Michael DuPont Sun Dec 8 23:54:06 2002
> Received: from [80.128.233.116] by web13301.mail.yahoo.com via HTTP;
> Sun, 08 Dec 2002 23:54:06 PST
> Date: Sun, 8 Dec 2002 23:54:06 -0800 (PST)
> From: James Michael DuPont <address@hidden>
> Subject: example librdf wrapping
> To: address@hidden
> MIME-Version: 1.0
> Content-Type: text/plain; charset=us-ascii
> Content-Length: 1132
>
> Dear all,
>
> I have here an example php4 debian plugin for php4/swig
>
http://introspector.sourceforge.net/debian/incoming/php4-redland_0.1.dsc
>
> based on the Redland/swig php. works great
>
> Only problem is with filehandles :
> the code generated is this
> if(SWIG_ConvertPtr(*args[1-argbase], (void **) &arg2,
> SWIGTYPE_p_FILE) < 0) {
> zend_error(E_ERROR, "Type error in argument %d of
> librdf_serializer_serialize_model. Expected %s", 2-argbase,
> SWIGTYPE_p_FILE->name);
> }
>
> I call it like this:
> $fp = fopen("./output.rdf", "w");
> librdf_serializer_serialize_model($pserializer, $fp, NULL,
> $pmodel);
> librdf_free_serializer($pserializer);
>
> It does not like the parameter :
> Fatal error: Type error in argument 2 of
> librdf_serializer_serialize_model. Expected _p_FILE in
>
/mnt/hda4/development/development2/redland-cvs/redland/librdf/php4-redland-0.1/test_redland.php
> on line.
>
> here is the example code
> #! /usr/bin/php4 -f
> <?
> $y = phpinfo();
>
> global $REDLAND_LOADED__;
> if ($REDLAND_LOADED__) return;
> $REDLAND_LOADED__ = true;
>
> /* if our extension has not been loaded, do what we can */
> /*
> not needed,added to the ini file
> /etc/php4/cgi/php.ini
> extension=libphp4-redland.so
>
> if (!extension_loaded("libphp4-redland")) {
> if (!dl("libphp4-redland.so")) return;
> }
> */
>
>
> $x = librdf_new_world();
> librdf_world_open($x);
> $storage=librdf_new_storage($x,
> "hashes", "test",
> "new='yes',hash-type='bdb',dir='.'");
> $pmodel=librdf_new_model($x, $storage, NULL);
>
>
>
> $pobject= librdf_new_node_from_literal($x,
> "test", 0,0);
> $ppredicate= librdf_new_node_from_literal($x,
> "doit",0, 0);
> $psubject= librdf_new_node_from_literal($x,
> "id-1",0, 0);
>
> $pstatement=librdf_new_statement($x);
>
> librdf_statement_set_subject($pstatement,$psubject); // the current
> object
> librdf_statement_set_predicate($pstatement,$ppredicate); // the uri
> passed
> librdf_statement_set_object($pstatement,$pobject); // the
> object passed
>
> $uri =librdf_new_uri($x,"file:./test.n3");
>
> librdf_model_add_statement($pmodel, $pstatement); // book'
> em
>
> $pserializer=librdf_new_serializer($x, "ntriples", NULL, $uri);
>
> $fp = fopen("./output.rdf", "w");
> librdf_serializer_serialize_model($pserializer, $fp, NULL,
> $pmodel);
> librdf_free_serializer($pserializer);
>
> ?>
>
>
>
>
> =====
> James Michael DuPont
> http://introspector.sourceforge.net/
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
=====
James Michael DuPont
http://introspector.sourceforge.net/
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Debian-sf-devel] Fwd: example librdf wrapping,
James Michael DuPont <=