You can subscribe to this list here.
2005 |
Jan
|
Feb
(16) |
Mar
(6) |
Apr
(38) |
May
(23) |
Jun
(5) |
Jul
(1) |
Aug
|
Sep
(10) |
Oct
(7) |
Nov
(6) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(20) |
Feb
(32) |
Mar
(24) |
Apr
(29) |
May
(5) |
Jun
(10) |
Jul
(12) |
Aug
(7) |
Sep
(1) |
Oct
(2) |
Nov
(27) |
Dec
(4) |
2007 |
Jan
(37) |
Feb
(10) |
Mar
(19) |
Apr
(10) |
May
(10) |
Jun
(7) |
Jul
(19) |
Aug
(29) |
Sep
(5) |
Oct
(17) |
Nov
(14) |
Dec
(2) |
2008 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
(8) |
May
|
Jun
(8) |
Jul
(1) |
Aug
(7) |
Sep
|
Oct
(1) |
Nov
(4) |
Dec
|
2009 |
Jan
|
Feb
(1) |
Mar
|
Apr
(1) |
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(2) |
2010 |
Jan
|
Feb
(2) |
Mar
(2) |
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
(2) |
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(2) |
2019 |
Jan
(1) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Dwi M. <edu...@gm...> - 2007-08-14 08:47:50
|
Hi All, I am doing diploma thesis and using RDF API PHP in my application. I try the example of InfModelF and I got error "Notice: "Object of class Resource could not be converted to int" in file \lib\rdfapi-php\api\infModel\InfRule.php (on line 233)" Any body can solve this error? Thanks Dwi |
From: Christian W. <cw...@cw...> - 2007-08-01 15:17:26
|
Luc, > > - The second one was more complicated. When we made a sparql query > > containing a FILTER clause, we got an sql error. It seems that=20 > > objects > > were passed to some methods instead of strings in the > > api/sparql/SparqlEngineDb/FilterGenerator.php file. As we make=20 > > extensive > > use of FILTER in our application, this was quite problematic. =46rom version 5.2.0, PHP implicitely uses toString(), and SparqlEngineDb'S FilterGenerator works without problems. The cases you fixed are only a subset of all places in which toString() would need to be called explicitely. It would make the code really unreadable if all occurences in which the objects are used as string got a toString() added, thus I opt for not doing this but requiring at least php 5.2.0. --=20 Regards/Mit freundlichen Gr=FC=DFen Christian Weiske |
From: Chris B. <ch...@bi...> - 2007-08-01 14:34:26
|
Hi Luc and Christian, Luc: Thanks a lot for reporting this bug and for providing a patch to it. Bug reports including a patche are clearly the best and always highly welcome! Christian Weiske implemented the new SPARQL engine and I have therefore cc'ed him to this mail. Christian: Would it be possible that you have a look at Luc's patch and include it into the SVN version of RAP, if it solves the problem properly. Thanks a lot. Cheers Chris ----- Original Message ----- From: <luc...@tu...> To: <ch...@bi...> Cc: <ala...@tu...>; <jea...@tu...> Sent: Wednesday, August 01, 2007 3:44 PM Subject: Fw: sparql bugs in rap 0.9.5 > Dear Chris, > > we have found two bugs in the sparql part of the latest release of > your > RAP library (0.9.5) : > > - The first one is that there are some trailing new lines at the end > of > the api/model/ModelFactory.php file. This can conflict with php > applications which use header() for example. > - The second one was more complicated. When we made a sparql query > containing a FILTER clause, we got an sql error. It seems that > objects > were passed to some methods instead of strings in the > api/sparql/SparqlEngineDb/FilterGenerator.php file. As we make > extensive > use of FILTER in our application, this was quite problematic. > > Please find attached a patch containing our fixes to these two bugs. > > Thanks for your great job on this library. > > Best Regards, > > Luc Dehand > > |
From: Chris B. <ch...@bi...> - 2007-07-29 13:55:32
|
Hi Christian, the W3C DAWG is asking us for running their new SPARQL test suite against the RAP SPARQL engine in order produce an implementation report for advancing SPARQL to a W3C Propoposed Recommendation. As you have implemented the new SPARQL engine for RAP 0.9.5 would it be possible that you run these tests against the engine and report the results to the DAWG and RAP mailing lists? This would be a great help for showcasing the quality of the engine and for helping DAWG to finally get the SPARQL spec out. Cheers Chris -- Chris Bizer Freie Universität Berlin +49 30 838 54057 ch...@bi... www.bizer.de ----- Original Message ----- From: "Lee Feigenbaum" <le...@th...> To: <ch...@bi...> Sent: Sunday, July 29, 2007 12:48 AM Subject: SPARQL test suite and implementation report > Hi Chris, > > I'm sending you this note with reference to your work both on RAP and also > on D2R (I'll probably send one to Richard as well), though I'm not sure > how easily / possible it would be to run the SPARQL tests via D2R (and not > sure whether that tests anything beyond the ARQ engine that it's built on > top of?). > > The DAWG has been working over the past few months to create a > relatively thorough and accurate set of test suites for the SPARQL query > language specification. We're working to produce an implementation > report for SPARQL as in order to satisfy one of the DAWG's > criteria for advancing SPARQL to W3C Propoposed Recommendation. > > We're not yet finished adding tests, but we have a lot of tests approved > and the structure and vocabularies used within the test suite and > results have matured to a point of stability such that we're beginning > to ask the owners of SPARQL implementations to take a look at the test > suite. > > Here's the relevant information: > > A README describes the vocabularies used to describe and structure the > DAWG tests in manifest files: > http://www.w3.org/2001/sw/DataAccess/tests/README.html > > An overview page provides a human-readable description of the approved > tests: > http://www.w3.org/2001/sw/DataAccess/tests/r2 > > We also have a document showing how to use the EARL vocabulary to report > results of running tests against your implementation. (EARL is an RDF > schema for reporting test results produced by the W3C Evaluation and > Repair Tools working group.) > http://www.w3.org/2001/sw/DataAccess/tests/earl > > While we'd appreciate it if you could report results in this EARL > format, we'd be glad to receive implementation reports in other formats > as well. > > What we'd like from you: In order that we can manage expectations in > generating our implementation report, it would be great if you could let > me know whether you think you'll be able to contribute results, and, if > so, how long you expect to need to produce the results. (We're aiming to > complete the test suite by early August and hoping to produce an > implementation report by the middle of September.) [We'll be sending out > a further email once the test suite is finished, so that we can begin > collecting complete results.] > > Please direct questions about the test suite to > pub...@w3..., a mailing list with a public archive. > Test results can be sent to that same list or else directly to me (but > please indicate that the Working Group can use your results). > > thanks, > Lee > on behalf of the DAWG > > PS. We've collected lists of SPARQL implementations from word-of-mouth > and from the ESW wiki: http://esw.w3.org/topic/SparqlImplementations If > you know of any other implementations that we might not have on our > list, we'd love to learn of them. > > PPS. Note that the old overview page[1] is still in place, but the tests > listed there are not part of the approved DAWG test suite (though many > have been copied over and approved). > > [1] http://www.w3.org/2001/sw/DataAccess/tests/ > > > > |
From: <pl...@do...> - 2007-07-21 17:07:18
|
Christian (or whoever may be able to answer :), Unfortunately (unless you've spotted something I've not?) I don't see =20 any way that you can disambiguate this case. How can we know from the =20 Query object if the query was { { ?s :p1 ?o } OPTIONAL { ?s :p2 ?o2 . } { ?s :p3 ?o3 . } } or { { ?s :p1 ?o } OPTIONAL { { ?s :p2 ?o2 . } { ?s :p3 ?o3 . } } } ...as the Query object contains nothing linking those BGPs (?s :p2 ?o2 =20 and ?s :p3 ?o3) as the right hand side of the OPTIONAL? They are =20 simply graph patterns in the Array, the same as ?s :p1 ?o; the SPARQL =20 engine will simply join them onto the result, not left-join them. Am I =20 missing something? Cheers, Peter Quoting Christian Weiske <cw...@cw...>: > Peter, > >> triple pattern. However, RAP parses this into a Query opbject >> equivalent to: >> >> { >> { ?s :p1 ?o } >> OPTIONAL >> { } >> { ?s :p2 ?o2 . } >> { ?s :p3 ?o3 . } >> } > > This is a behavior of SparqlParser that is weird, but cannot be taken > away simply due to the internal working. > In my SparqlEngineDb, I check if the pattern is empty and skip it in > that case. > > > -- > Regards/Mit freundlichen Gr=FC=DFen > Christian Weiske > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Microsoft > Defy all challenges. Microsoft(R) Visual Studio 2005. > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > |
From: Christian W. <cw...@cw...> - 2007-07-21 07:31:13
|
Peter, > triple pattern. However, RAP parses this into a Query opbject > equivalent to: >=20 > { > { ?s :p1 ?o } > OPTIONAL > { } > { ?s :p2 ?o2 . } > { ?s :p3 ?o3 . } > } This is a behavior of SparqlParser that is weird, but cannot be taken away simply due to the internal working. In my SparqlEngineDb, I check if the pattern is empty and skip it in that case. --=20 Regards/Mit freundlichen Gr=FC=DFen Christian Weiske |
From: <pl...@do...> - 2007-07-20 11:48:45
|
Dear all, I've recently been digging around inside the SPARQL engine, and have =20 come across some behaviour which I *believe* to be contrary to the =20 SPARQL spec (although I'm very much open to being corrected :) Given a query WHERE clause such as { { ?s :p1 ?o } OPTIONAL { ?s :p2 ?o2 . ?s :p3 ?o3 . } } RAP parses it into a Query object as expected; two GraphPattern =20 objects, with the latter being marked as the OPTIONAL clause part of =20 the former. However, consider: { { ?s :p1 ?o } OPTIONAL { { ?s :p2 ?o2 . } { ?s :p3 ?o3 . } } } This would appear to be a valid SPARQL construct; the group graph =20 pattern of the right-hand-side of the OPTIONAL clause contains two =20 basic graph patterns within it, each containing a single query triple =20 pattern. However, RAP parses this into a Query opbject equivalent to: { { ?s :p1 ?o } OPTIONAL { } { ?s :p2 ?o2 . } { ?s :p3 ?o3 . } } ...effectively saying "?s :p1 ?o; :p2 ?o2; :p3 ?o3, and optionally =20 nothing else". Is this the desired behaviour for the parser? Please =20 feel free to correct me if I've made a mistake; but it appears as if =20 the advent of a new BGP is causing the GGP to be terminated (the spec =20 only provides for the advent of a new BGP to close any previously open =20 BGP, not GGP, as far as I'm aware :) Thanks very much for any clarification you may be able to offer! Cheers, Peter |
From: Olivier B. <oli...@in...> - 2007-07-17 11:03:49
|
Le lundi 16 juillet 2007 =C3=A0 19:11 +0200, Christian Weiske a =C3=A9crit = : > Olivier, >=20 >=20 >=20 > > Btw, it may be interesting to document on the project's webpage which > > versions work with which PHP version, I think. > >=20 > > My guess is : > > PHP4 : <=3D 0.9.4 > > PHP5 : >=3D 0.9.5 >=20 > As far as I know, only the Sparql part requires PHP5.=20 >=20 Maybe... I've had a couple errors with PHP 4.4.4... so didn't really investigate as to which submodule was faulty... Anyway, maybe now PHP4 is dying, it's no longer such a big deal ;) Best regards, --=20 Olivier BERGER <oli...@in...> (ATTENTION : new address) Ing=C3=A9nieur Recherche - Dept INF GET/INT at Evry (http://www.int-edu.eu/) OpenPGP-Id: 1024D/6B829EEC |
From: Christian W. <cw...@cw...> - 2007-07-16 17:11:21
|
Olivier, > Btw, it may be interesting to document on the project's webpage which > versions work with which PHP version, I think. >=20 > My guess is : > PHP4 : <=3D 0.9.4 > PHP5 : >=3D 0.9.5 As far as I know, only the Sparql part requires PHP5. My SparqlEngineDb requires at least PHP 5.2.0 because only from this version on, __toString() is automatically called when needed. --=20 Regards/Mit freundlichen Gr=FC=DFen Christian Weiske |
From: Olivier B. <oli...@in...> - 2007-07-16 15:24:47
|
Le lundi 16 juillet 2007 =C3=A0 16:26 +0200, Olivier Berger a =C3=A9crit : > Hi. >=20 > FYI, I have packaged, in addition to the version 0.9.5, which requires > PHP5 AFAICT, version 0.9.4, which only requires PHP4. >=20 Btw, it may be interesting to document on the project's webpage which versions work with which PHP version, I think. My guess is : PHP4 : <=3D 0.9.4 PHP5 : >=3D 0.9.5 Am I right ? Best regards,=20 --=20 Olivier BERGER <oli...@in...> (ATTENTION : new address) Ing=C3=A9nieur Recherche - Dept INF GET/INT at Evry (http://www.int-edu.eu/) OpenPGP-Id: 1024D/6B829EEC |
From: Olivier B. <oli...@in...> - 2007-07-16 14:32:18
|
Hi. May I suggest some sort of possibility to use new DB connection options for ModelFactory::getDbStore() function. This would allow use a new argument maybe (see proposed patch link bellow), which, if present, would be the DSN for ADODB. This would have the advantage of allowing the use of more advanced connection mechanisms, like persistent connections, etc.=20 Example :=20 instead of using : $this->dbstore =3D ModelFactory::getDbStore('MySQL', 'localhost',=20 'database', 'user', 'pass'); which would do a standard ADODB Connect() (reusing the previous=20 connection), one could use : $this->dbstore =3D ModelFactory::getDbStore(NULL, NULL, NULL, NULL,=20 NULL,=20 'mysql://user:pass@localhost/database?new'); which will use a ADODB NConnect(), creating a new connection each time. See the corresponding patch at : http://picoforge.int-evry.fr/websvn/filede= tails.php?repname=3Dpicoforge&path=3D%2Ftrunk%2Flibphp-rap%2Fpatching%2Fdsn= .patch&rev=3D0&sc=3D1 Any comments ? Hope this helps, Best regards, --=20 Olivier BERGER <oli...@in...> (ATTENTION : new address) Ing=C3=A9nieur Recherche - Dept INF GET/INT at Evry (http://www.int-edu.eu/) OpenPGP-Id: 1024D/6B829EEC |
From: Olivier B. <oli...@in...> - 2007-07-16 14:27:02
|
Hi. FYI, I have packaged, in addition to the version 0.9.5, which requires PHP5 AFAICT, version 0.9.4, which only requires PHP4. You'll find more details from https://picoforge.int-evry.fr/cgi-bin/twiki/view/Picoforge/Web/RapPhpLibDeb= ianPackage Best regards, Le vendredi 29 juin 2007 =C3=A0 18:22 +0200, Olivier Berger a =C3=A9crit : > Hi. >=20 > Maybe I should have asked first, but anyway, I've started and create an > unofficial Debian package for the library, which some of you may be > interested in... >=20 > I hope no one else has done it before ;) >=20 > If you are interested, you may find the unofficial package here : http://= picoforge.int-evry.fr/websvn/filedetails.php?repname=3Dpicoforge&path=3D%2F= trunk%2Flibphp-rap%2Flibphp-rap_0.9.5-1_all.deb&rev=3D0&sc=3D1=20 > and the associated files (sources for the Debian package) here : http://p= icoforge.int-evry.fr/websvn/listing.php?repname=3Dpicoforge&path=3D%2Ftrunk= %2Flibphp-rap%2F&opt=3Ddir&sc=3D1 >=20 > I welcome any critics or comments, of course. >=20 > Best regards, >=20 > P.S.: we're trying to use RAP for some RDF, DOAP, FOAF, etc processing, s= o I though it could be convenient to base on a packaged version in case of = deployment needs. --=20 Olivier BERGER <oli...@in...> (ATTENTION : new address) Ing=C3=A9nieur Recherche - Dept INF GET/INT at Evry (http://www.int-edu.eu/) OpenPGP-Id: 1024D/6B829EEC |
From: Seaborne, A. <and...@hp...> - 2007-07-10 10:48:19
|
Tim, I agree systems should do the helpful thing, especially as I was bitten by the "~"/%7E thing only last week. =20 (I've included pointers and text so others can quicky find the places I'l talking about.) rfc3986.txt/6.2.2.2 says unreserved characters can be decoded and specifically points to where unreserved is defined in 2.3, but does not go further and say that any character that did not need to be encoded can be decoded - there's no mention of component parts. 6.2.2.2. [[ These URIs should be normalized by decoding any percent-encoded octet that corresponds to an unreserved character, as described in Section 2.3. ]] and section 2.3 says: [[ unreserved =3D ALPHA / DIGIT / "-" / "." / "_" / "~" ]] which does not list ",". So my processor concludes the URIs differed in the absence of any other information to avoid false positives. 2396 has a wider list of unreservered but still no "," unreserved =3D alphanum | mark mark =3D "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" Getting schme specific: RFC 2616: sec 3.2.3 [[ Characters other than those in the "reserved" and "unsafe" sets (see RFC 2396 [42]) are equivalent to their ""%" HEX HEX" encoding. ]] but there is no production for "unsafe" in 2396. There is "unwise". [[ reserved =3D ";" | "/" | "?" | ":" | "@" | "&" | "=3D" | "+" | "$" | "," ]] so it does include "," hence, still the 2 URIs are different. Some domain specific rule might also inform the processor that, say, people's names can be written either way with in "family,given" form./ It maybe it could analsyise the structure of the URI and conclude that a "," at this point is safe and so decode but it can't really conclude that was the intent of the URI producer - I couldn't find anything in the HTTP spec that would license and did find text that spoke against it. Andy -------- Original Message -------- > From: Tim Berners-Lee <mailto:ti...@w3...> > Date: 9 July 2007 18:08 >=20 > I take more or less the opposite view: It is a Good Thing for systems > to canonicalize URIS on input, or data and query. I know RDF does not > specify this. However, the URI spec gives one the ability to conclude > that the URIs are equivalent. =20 >=20 > There are several levels of canonicalization you can do. > There was a TAG issue about this > http://www.w3.org/2001/tag/issues.html#URIEquivalence-15 > "When are two URI variants considered equivalent?" > A draft finding "How to Compare Uniform Resource Identifiers" > http://www.textuality.com/tag/uri-comp-4 > was produced by Tim Bray about this and the results have been more > or less folded into the new URI spec.=20 >=20 > http://www.ietf.org/rfc/rfc3986.txt >=20 > See section 6 >=20 > In a way, as the URI spec says you can send the same URI in various > forms and mean the same thing, I am not doing users a favor if my > system does not recognize this. =20 >=20 > In practice, it avoids frustrating bugs like having equivalent URIs > stand for different things.=20 >=20 > Cwm will canonicalize only with the --closure=3Dn flag set. Also it > does canonicalize numbers.=20 >=20 > Tim BL >=20 >=20 > On 2007-07 -09, at 06:55, Seaborne, Andy wrote: >=20 > >=20 > > -------- Original Message -------- > > > From: T.Heath <> > > > Date: 8 July 2007 14:36 > > >=20 > > > Hi all, > > >=20 > > > I've come across an issue with SPARQL queries over graphs in which > > > URIs vary in their use of %-encoding, and hope members of this list > > > may be able to help out...=20 > > >=20 > > > Imagine you have two RDF graphs that reference the same URIs, except > > > that in one graph special characters in the URIs are %-encoded, and > > > in the second they are not. For example: > > >=20 > > > <http://some.example/example,first> in graph1 vs. > > > <http://some.example/example%2Cfirst> in graph2 > > >=20 > > > As far as I understand it (although I may be wrong) both these URIs > > > are the "same", despite their different syntactic form. However, > > > when performing SPARQL queries over the merge of the two graphs > > > these two URIs are not treated as the same, therefore making joins > > > of the data impossible (without pre-processing). I noticed this > > > behaviour first in RAP, but we've been able to replicate the effect > > > in Jena also.=20 > > >=20 > > > So, my question is: is this a bug in RAP, Jena, and presumably other > > > frameworks, or are there cases in which this is actually the desired > > > behaviour (i.e. it's a feature not a bug)? If the latter is true, > > > does this suggest that as a community we need a convention that we > > > will always mint and use URIs in which specialchars are %-encoded > > > (or the other way around) in order to avoid this kind of situation? > > >=20 > > > Any thoughts/pointers/enlightenment much appreciated, > >=20 > >=20 > > There is a difference between being an escape mechanism and being an > > endocing mechanism. %2C is not a way to escape a comma into a URI - > > it's a way of encoding the information. The difference is whether the > > URI really contains "," (escaping) or whether it really contains "%2C" > > (encoding). In the case of URIs, it's an encoding scheme and the URI > > really does contain the "%2C", and not ",". > >=20 > > For example: in a programming language, using \n for newline and the > > string "\n" then there is the single newline character in the string, > > and it's of length 1, not 2.=20 > >=20 > > RFC3986 gives advice on when to encode (sec 2.4) which is when the URI > > is turned from its subcomponents into the URI character string. > > Reverse at the other end. But while it's a URI character string, it > > is just a sequence of charcaters without interpretation of %-encoding. > >=20 > > For RDF, which is not constructing URIs from sub-components, the URI > > is the character string. It should not change it (apply %-rules) to > > do comparisons.=20 > >=20 > > So my understanding of: > > """ > > Two RDF URI references are equal if and only if they compare as equal, > > character by character, as Unicode strings. > > """ > > is that it means compare strings as given, not by applying %-decoding > >=20 > > http://some.example/example,first is not the same as > > http://some.example/example%2Cfirst. > >=20 > > Andy > >=20 > >=20 > > >=20 > > > Cheers, > > >=20 > > > Tom. > > >=20 > > > P.S. FWIW the Dbpedia community has recently settled on always > > > using %-encoded URIs.=20 > > >=20 > > > -- > > > Tom Heath > > > PhD Student > > > Knowledge Media Institute > > > The Open University > > > Walton Hall > > > Milton Keynes > > > MK7 6AA > > > United Kingdom > > >=20 > > > Tel: +44 (0)1908 653565 > > > Fax: +44 (0)1908 653169 > > > Web/URI: http://kmi.open.ac.uk/people/tom/ > > > Jabber: t.heath%ope...@bu... |
From: <pl...@do...> - 2007-07-09 15:45:43
|
Dear all, I've been working with RDF datasets and persistent named graphs in RAP =20 today, and have encountered some unexpected behaviour. I'm not sure if =20 this is a result of my misunderstanding the documentation, or of a bug =20 somewhere in RAP; I hope someone here will be able to help! Suppose I create two datasets, and create a named graph in each with =20 the same URI. If I add a statement to the first of these, it is added =20 to only the first model (as I'd expect). If, however, at a later time =20 I get these datasets and graphs again, and again add a statement to =20 the first model, I find it has propagated to /both/ of these models. I have to confess to more than just mild confusion at this point :) =20 I've enclsoed as close as I can get to a complete-minimal-runnable =20 test case. The code below produces the given output on two successive =20 runs: __________________________________________________________________ Code: <?php define("RDFAPI_INCLUDE_DIR", "api/"); require_once(RDFAPI_INCLUDE_DIR . "RdfAPI.php"); require_once(RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_RDF); require_once(RDFAPI_INCLUDE_DIR . PACKAGE_SYNTAX_N3); define("BASE", "http://example.com/"); $name =3D BASE . 'models/named/content'; $dbconn =3D ModelFactory::getDbStore( 'MySQL', 'localhost', 'example', =20 'example', 'example' ); $ddb1 =3D $dbconn->getDatasetDb( BASE . 'models/knows' ); if ( $ddb1 =3D=3D=3D false ) $ddb1 =3D $dbconn->getNewDatasetDb( BASE . 'models/knows' ); $ddb2 =3D $dbconn->getDatasetDb( BASE . 'models/names' ); if ( $ddb2 =3D=3D=3D false ) $ddb2 =3D $dbconn->getNewDatasetDb( BASE . 'models/names' ); if ( $ddb1->containsNamedGraph( $name ) ) $c1 =3D $ddb1->getNamedGraph( $name ); else $c1 =3D $ddb1->createGraph( $name ); if ( $ddb2->containsNamedGraph( $name ) ) $c2 =3D $ddb2->getNamedGraph( $name ); else $c2 =3D $ddb2->createGraph( $name ); $c1->add( new Statement( new Resource( BASE . 'someSubject' ), new =20 Resource( BASE . 'somePredicate' ), new Literal( 'Some Object' ) ) ); $c1->writeAsHtml(); echo "<br /><br />\n"; $c2->writeAsHtml(); ?> __________________________________________________________________ First Execution: <?xml version=3D"1.0" encoding=3D"UTF-8" ?> <!-- Generated by RdfSerializer.php from RDF RAP. # http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html !--> <rdf:RDF xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs=3D"http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema#" xmlns:owl=3D"http://www.w3.org/2002/07/owl#" xmlns:dc=3D"http://purl.org/dc/elements/1.1/" xmlns:dcterms=3D"http://purl.org/dc/terms/" xmlns:vcard=3D"http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:ns1=3D"http://example.com/"> <rdf:Description rdf:about=3D"http://example.com/someSubject"> <ns1:somePredicate>Some Object</ns1:somePredicate> </rdf:Description> </rdf:RDF> <rdf:RDF xmlns:rdf=3D'http://www.w3.org/1999/02/22-rdf-syntax-ns#' /> __________________________________________________________________ Second Execution: <?xml version=3D"1.0" encoding=3D"UTF-8" ?> <!-- Generated by RdfSerializer.php from RDF RAP. # http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html !--> <rdf:RDF xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs=3D"http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema#" xmlns:owl=3D"http://www.w3.org/2002/07/owl#" xmlns:dc=3D"http://purl.org/dc/elements/1.1/" xmlns:dcterms=3D"http://purl.org/dc/terms/" xmlns:vcard=3D"http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:ns1=3D"http://example.com/"> <rdf:Description rdf:about=3D"http://example.com/someSubject"> <ns1:somePredicate>Some Object</ns1:somePredicate> </rdf:Description> </rdf:RDF> <?xml version=3D"1.0" encoding=3D"UTF-8" ?> <!-- Generated by RdfSerializer.php from RDF RAP. # http://www.wiwiss.fu-berlin.de/suhl/bizer/rdfapi/index.html !--> <rdf:RDF xmlns:rdf=3D"http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs=3D"http://www.w3.org/2000/01/rdf-schema#" xmlns:xsd=3D"http://www.w3.org/2001/XMLSchema#" xmlns:owl=3D"http://www.w3.org/2002/07/owl#" xmlns:dc=3D"http://purl.org/dc/elements/1.1/" xmlns:dcterms=3D"http://purl.org/dc/terms/" xmlns:vcard=3D"http://www.w3.org/2001/vcard-rdf/3.0#" xmlns:ns1=3D"http://example.com/"> <rdf:Description rdf:about=3D"http://example.com/someSubject"> <ns1:somePredicate>Some Object</ns1:somePredicate> </rdf:Description> </rdf:RDF> __________________________________________________________________ As an aside; if I create these statements through the addQuad() =20 interface, it adds them only to the first model, as I'd have expected. I hope that I've enclosed enough information for someone to be able to =20 reproduce this behaviour (and that I've not just wasted everyone's =20 time through my own stupidity ;) Thanks in advance for your time, and any suggestions you may have! Cheers, Peter |
From: Seaborne, A. <and...@hp...> - 2007-07-09 10:55:33
|
-------- Original Message -------- > From: T.Heath <> > Date: 8 July 2007 14:36 >=20 > Hi all, >=20 > I've come across an issue with SPARQL queries over graphs in which URIs > vary in their use of %-encoding, and hope members of this list may be > able to help out... =20 >=20 > Imagine you have two RDF graphs that reference the same URIs, except > that in one graph special characters in the URIs are %-encoded, and in > the second they are not. For example: =20 >=20 > <http://some.example/example,first> in graph1 vs. > <http://some.example/example%2Cfirst> in graph2 >=20 > As far as I understand it (although I may be wrong) both these URIs are > the "same", despite their different syntactic form. However, when > performing SPARQL queries over the merge of the two graphs these two > URIs are not treated as the same, therefore making joins of the data > impossible (without pre-processing). I noticed this behaviour first in > RAP, but we've been able to replicate the effect in Jena also. =20 >=20 > So, my question is: is this a bug in RAP, Jena, and presumably other > frameworks, or are there cases in which this is actually the desired > behaviour (i.e. it's a feature not a bug)? If the latter is true, does > this suggest that as a community we need a convention that we will > always mint and use URIs in which specialchars are %-encoded (or the > other way around) in order to avoid this kind of situation? =20 >=20 > Any thoughts/pointers/enlightenment much appreciated, There is a difference between being an escape mechanism and being an endocing mechanism. %2C is not a way to escape a comma into a URI - it's a way of encoding the information. The difference is whether the URI really contains "," (escaping) or whether it really contains "%2C" (encoding). In the case of URIs, it's an encoding scheme and the URI really does contain the "%2C", and not ",". For example: in a programming language, using \n for newline and the string "\n" then there is the single newline character in the string, and it's of length 1, not 2. RFC3986 gives advice on when to encode (sec 2.4) which is when the URI is turned from its subcomponents into the URI character string. Reverse at the other end. But while it's a URI character string, it is just a sequence of charcaters without interpretation of %-encoding. For RDF, which is not constructing URIs from sub-components, the URI is the character string. It should not change it (apply %-rules) to do comparisons. So my understanding of: """ Two RDF URI references are equal if and only if they compare as equal, character by character, as Unicode strings. """ is that it means compare strings as given, not by applying %-decoding http://some.example/example,first is not the same as http://some.example/example%2Cfirst. Andy >=20 > Cheers, >=20 > Tom. >=20 > P.S. FWIW the Dbpedia community has recently settled on always using > %-encoded URIs.=20 >=20 > -- > Tom Heath > PhD Student > Knowledge Media Institute > The Open University > Walton Hall > Milton Keynes > MK7 6AA > United Kingdom >=20 > Tel: +44 (0)1908 653565 > Fax: +44 (0)1908 653169 > Web/URI: http://kmi.open.ac.uk/people/tom/ > Jabber: t.heath%ope...@bu... |
From: Seaborne, A. <and...@hp...> - 2007-07-02 11:23:15
|
-------- Original Message -------- > From: Chris Bizer <mailto:ch...@bi...> > Date: 2 July 2007 10:49 >=20 > Hi Christian, >=20 > the benchmarks look really good! >=20 > I'm surprised too. Especially that we seam to beat Andy's new Jena SDB > engine which was especially implemented for speed. But I guess Andy > still has some configuration options in the back-hand which will make > his engine fly past RAP ;-) Finishing the coding being one of those options. SDB does pattern matching at the moment and, of these queries,the onlt = two patterns are { ?s ?p ?o } and {?s ?p ?o1 . ?s ?p ?o2 }. =20 All the queries have LIMIT so that is a significant thing being measured = SDB does not optimize LIMIT (or FILTER) yet. As a quick hack, using a = develop stream for SDB, I get .16s for the 100K triples set on SELECT * = {?s ?p ?o} LIMIT 10 Slightly faster if the DB server and client are = different machines. PostgreSQL. Load time: 100K triples: 5Ktriples/s 200K triples is a bit small side for SDB. Normally, that many triples = will end up in the database cache (fits in Jena mem graph as well) and = .1s is possibly JDBC time. Can SparqlEngineDb hold a subset of Uniprot, say the 100e6 subset of the = full 650e6 triples? We have SPARQL translations of the queries against = Uniprot. (The page is not clear whether this is Jena or SDB. It links to Jena. = SDB is mentioned only incidentally - note: SDB does not ship with the = Jena distribution.) Andy =20 >=20 > I have put links to the benchmark on the RAP project page. >=20 > Keep up the great work! >=20 > Cheers >=20 > Chris >=20 >=20 > -- > Chris Bizer > Freie Universit=E4t Berlin > Phone: +49 30 838 54057 > Mail: ch...@bi... > Web: www.bizer.de >=20 > ----- Original Message ----- > From: "Christian Weiske" <cw...@cw...> > To: "Sebastian Dietzold" <die...@in...>; = "S=F6ren > Auer" <au...@in...>=20 > Cc: <rdf...@li...> > Sent: Monday, July 02, 2007 8:51 AM > Subject: [Rdfapi-php-interest] SparqlEngineDb benchmark results >=20 >=20 > Hello, >=20 >=20 > I made some benchmarks comparing RAP's new SparqlEngineDb against > competitors like ARC, Jena and Redland.=20 > Results can be seen at > = http://cweiske.de/tagebuch/SPARQLer's%20best%20choice:%20SparqlEngineDb.h= tm >=20 > -- > Mit freundlichen Gr=FC=DFen/Regards, > Christian Weiske >=20 > = -------------------------------------------------------------------------= > This SF.net email is sponsored by DB2 Express Download DB2 Express C - > the FREE version of DB2 express and take control of your XML. No > limits. Just data. Click to get it now. =20 > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest |
From: Chris B. <ch...@bi...> - 2007-07-02 11:19:20
|
Hi Olivier, thanks for putting the Debian package together. I'm myself not a Debian user, so no comments from my side, but I have put a link to your package into the download section of the RAP page, which might raise some interest, comments and bug reports ;-) Cheers Chris -- Chris Bizer Freie Universität Berlin Phone: +49 30 838 54057 Mail: ch...@bi... Web: www.bizer.de ----- Original Message ----- From: "Olivier Berger" <oli...@in...> To: <rdf...@li...> Sent: Friday, June 29, 2007 6:22 PM Subject: [Rdfapi-php-interest] Debian package for RAP library ? > Hi. > > Maybe I should have asked first, but anyway, I've started and create > an > unofficial Debian package for the library, which some of you may be > interested in... > > I hope no one else has done it before ;) > > If you are interested, you may find the unofficial package here : > http://picoforge.int-evry.fr/websvn/filedetails.php?repname=picoforge&path=%2Ftrunk%2Flibphp-rap%2Flibphp-rap_0.9.5-1_all.deb&rev=0&sc=1 > and the associated files (sources for the Debian package) here : > http://picoforge.int-evry.fr/websvn/listing.php?repname=picoforge&path=%2Ftrunk%2Flibphp-rap%2F&opt=dir&sc=1 > > I welcome any critics or comments, of course. > > Best regards, > > P.S.: we're trying to use RAP for some RDF, DOAP, FOAF, etc > processing, so I though it could be convenient to base on a packaged > version in case of deployment needs. > -- > Olivier BERGER <oli...@in...> (ATTENTION : new address) > Ingénieur Recherche - Dept INF > GET/INT at Evry (http://www.int-edu.eu/) > OpenPGP-Id: 1024D/6B829EEC > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > |
From: Richard C. <ri...@cy...> - 2007-07-02 10:32:43
|
Christian, On 2 Jul 2007, at 08:51, Christian Weiske wrote: > I made some benchmarks comparing RAP's new SparqlEngineDb against =20 > competitors like ARC, Jena and Redland. > Results can be seen at > http://cweiske.de/tagebuch/SPARQLer's%20best%20choice:%=20 > 20SparqlEngineDb.htm Interesting. The benchmark seems to be designed to investigate how =20 the different implementations compare in terms of query parsing and =20 result processing overhead, and the new engine seems to do very well =20 in this regard. It would be very interesting to have some benchmarks =20 that show end-to-end performance for the kind of queries often used =20 in applications, e.g. - datasets beyond 200k triples, - queries that don't have a LIMIT 10 clause, - queries that combine a small LIMIT lause with an ORDER BY and =20 possibly OFFSET (typical for web applications where results are paged), And, also very important, though these queries are not data independent: - queries that have more than two triple patterns, - queries with at least one known node (e.g. a given URI as the ?s) Some more notes: The page should mention which versions of the =20 different libraries were used, and which kind of machine this was run =20= on. I also wondered what the unit of the y axis on the charts is. =20 Also, which Jena component was tested, the ModelRDB included with =20 Jena [1] (as implied by the link to the Jena homepage), or the alpha =20 SDB [2] (as stated further down on the page)? Cheers, Richard [1] http://jena.sourceforge.net/DB/index.html [2] http://jenawiki.hpl.hp.com/wiki/SDB > > --=20 > Mit freundlichen Gr=FC=DFen/Regards, > Christian Weiske > > ----------------------------------------------------------------------=20= > --- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > |
From: Chris B. <ch...@bi...> - 2007-07-02 09:52:35
|
Hi Christian, the benchmarks look really good! I'm surprised too. Especially that we seam to beat Andy's new Jena SDB engine which was especially implemented for speed. But I guess Andy still has some configuration options in the back-hand which will make his engine fly past RAP ;-) I have put links to the benchmark on the RAP project page. Keep up the great work! Cheers Chris -- Chris Bizer Freie Universität Berlin Phone: +49 30 838 54057 Mail: ch...@bi... Web: www.bizer.de ----- Original Message ----- From: "Christian Weiske" <cw...@cw...> To: "Sebastian Dietzold" <die...@in...>; "Sören Auer" <au...@in...> Cc: <rdf...@li...> Sent: Monday, July 02, 2007 8:51 AM Subject: [Rdfapi-php-interest] SparqlEngineDb benchmark results Hello, I made some benchmarks comparing RAP's new SparqlEngineDb against competitors like ARC, Jena and Redland. Results can be seen at http://cweiske.de/tagebuch/SPARQLer's%20best%20choice:%20SparqlEngineDb.htm -- Mit freundlichen Grüßen/Regards, Christian Weiske ------------------------------------------------------------------------- This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Rdfapi-php-interest mailing list Rdf...@li... https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest |
From: P.L.Coetzee <P.L...@op...> - 2007-07-02 08:33:10
|
Dear all, As Christian suggested, I've modified the MysqlFindIterator I posted = previously to use the same ADODB mechanism as RAP prefers. Instead of = taking connection parameters and model URI on the constructor, it now = takes the DBModel which you wish to execute the find() over and extracts = its data from that. Thanks for suggesting the change Christian - it = should hopefully be more widely usable now :) As ever, comments gratefully received! Cheers, Peter ______________________________________________________ ADOFindIterator.class.php: <?php /* * Find Iterator operating over an ADODB Connection, to work in ~linear = time * Particular application in iterating over large datasets, performs = faster * + in a more scalable manner than the existing FindIterator class. * * Author: Peter Coetzee * */ class ADOFindIter { private $curr; private $res; private $dbConn; private $dummy; // Pre: $dbmodel is a connected RAP DB Model. // Post: Prepare Iterator for operation. If $ordered =3D=3D = true, // select rows ordered by subject then predicate, for ease // of processing. public function ADOFindIter( $dbModel, $ordered=3Dfalse, $sub=3Dnull, $pred=3Dnull, = $obj=3Dnull ) { $this->dbConn =3D $dbModel->getDbConn(); $modelID =3D $dbModel->getModelID(); $sql =3D "SELECT subject, predicate, object, = subject_is, " . "object_is, l_language, l_datatype FROM = statements " . "WHERE modelID =3D $modelID"; if ( $sub !=3D null ) $sql .=3D " AND subject =3D '$sub'"; if ( $pred !=3D null ) $sql .=3D " AND predicate =3D '$pred'"; if ( $obj !=3D null ) $sql .=3D " AND object =3D '$obj'"; if ( $ordered ) $sql .=3D " ORDER BY subject, predicate"; $this->res =3D &$this->dbConn->Execute( $sql ) or die( "ADODB error: " . = $dbConn->ErrorMsg() ); $this->dummy =3D ModelFactory::getDefaultModel(); $this->curr =3D $this->res->fields; } // Post: Return the next statement in the Iterator public function next() { if ( $this->curr =3D=3D null && !$this->hasNext() ) return null; if ( $this->curr[4] =3D=3D 'l' ) { $object =3D new Literal( $this->curr[2] ); if ( $this->curr[5] !=3D '' && $this->curr[5] = !=3D null ) $object->setLanguage( $this->curr[5] ); if ( $this->curr[6] !=3D '' && $this->curr[6] = !=3D null ) $object->setDatatype( $this->curr[6] ); } else if ( $this->curr[4] =3D=3D 'b' ) { $object =3D new BlankNode( $this->dummy ); } else { $object =3D new Resource( $this->curr[2] ); } $predicate =3D new Resource( $this->curr[1] ); if ( $this->curr[3] =3D=3D 'r' ) $subject =3D new Resource( $this->curr[0] ); else $subject =3D new BlankNode( $this->dummy ); $this->curr =3D null; return new Statement( $subject, $predicate, $object ); } // Post: True iff there is another Statement in the Iterator public function hasNext() { return $this->curr =3D=3D null ? ( !$this->res->EOF && $this->res->MoveNext() && $this->curr =3D $this->res->fields ) : = true; } // Post: Answer the number of Statements in the Iterator public function size() { return $this->res->RecordCount(); } // Post: Free up resources used by this Iterator. Behaviour of = any // subsequent calls is undefined. public function free() { $this->res->Close(); } } ?> -----Original Message----- From: rdf...@li... on behalf of = P.L.Coetzee Sent: Mon 02/07/2007 08:13 To: Christian Weiske; rdf...@li... Subject: Re: [Rdfapi-php-interest] FindIterator over a Database =20 Christian, I should imagine so - it started off as a simple exercise "make it work = for me", so I've not looked all that much into the innards of RAP etc. I = shall do so this morning, and post back once I've got something worth = looking at (or catastrophic failure, whichever comes first ;) Cheers, Peter P.S. - As an occasional-Jena-user, your benchmarks were particularly = intriguing! Thanks for sharing :) -----Original Message----- From: rdf...@li... on behalf of = Christian Weiske Sent: Sat 30/06/2007 07:43 To: rdf...@li... Subject: Re: [Rdfapi-php-interest] FindIterator over a Database =20 Peter, > This has led me to write the attached MysqlFindIterator class, which =20 > bypasses the RAP API, and instead queries the database directly. It =20 > scales in approximately linear time, so is useful for these large =20 > resultsets. At the moment I've only written it to handle MySQL =20 > databases, but it should be easily modifiable for whatever DB Driver =20 > you wish to use. Do you think it is possible to use RAP's preferred connection to = databases, ADODB? --=20 Mit freundlichen Gr=FC=DFen/Regards, Christian Weiske -------------------------------------------------------------------------= This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Rdfapi-php-interest mailing list Rdf...@li... https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest -------------------------------------------------------------------------= This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Rdfapi-php-interest mailing list Rdf...@li... https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest |
From: P.L.Coetzee <P.L...@op...> - 2007-07-02 07:14:08
|
Christian, I should imagine so - it started off as a simple exercise "make it work = for me", so I've not looked all that much into the innards of RAP etc. I = shall do so this morning, and post back once I've got something worth = looking at (or catastrophic failure, whichever comes first ;) Cheers, Peter P.S. - As an occasional-Jena-user, your benchmarks were particularly = intriguing! Thanks for sharing :) -----Original Message----- From: rdf...@li... on behalf of = Christian Weiske Sent: Sat 30/06/2007 07:43 To: rdf...@li... Subject: Re: [Rdfapi-php-interest] FindIterator over a Database =20 Peter, > This has led me to write the attached MysqlFindIterator class, which =20 > bypasses the RAP API, and instead queries the database directly. It =20 > scales in approximately linear time, so is useful for these large =20 > resultsets. At the moment I've only written it to handle MySQL =20 > databases, but it should be easily modifiable for whatever DB Driver =20 > you wish to use. Do you think it is possible to use RAP's preferred connection to = databases, ADODB? --=20 Mit freundlichen Gr=FC=DFen/Regards, Christian Weiske -------------------------------------------------------------------------= This SF.net email is sponsored by DB2 Express Download DB2 Express C - the FREE version of DB2 express and take control of your XML. No limits. Just data. Click to get it now. http://sourceforge.net/powerbar/db2/ _______________________________________________ Rdfapi-php-interest mailing list Rdf...@li... https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest |
From: Christian W. <cw...@cw...> - 2007-07-02 06:49:21
|
Hello, I made some benchmarks comparing RAP's new SparqlEngineDb against competito= rs like ARC, Jena and Redland. Results can be seen at http://cweiske.de/tagebuch/SPARQLer's%20best%20choice:%20SparqlEngineDb.htm --=20 Mit freundlichen Gr=FC=DFen/Regards, Christian Weiske |
From: Christian W. <cw...@cw...> - 2007-06-30 06:42:10
|
Peter, > This has led me to write the attached MysqlFindIterator class, which =20 > bypasses the RAP API, and instead queries the database directly. It =20 > scales in approximately linear time, so is useful for these large =20 > resultsets. At the moment I've only written it to handle MySQL =20 > databases, but it should be easily modifiable for whatever DB Driver =20 > you wish to use. Do you think it is possible to use RAP's preferred connection to databases,= ADODB? --=20 Mit freundlichen Gr=FC=DFen/Regards, Christian Weiske |
From: Olivier B. <oli...@in...> - 2007-06-29 16:21:32
|
Hi. Maybe I should have asked first, but anyway, I've started and create an unofficial Debian package for the library, which some of you may be interested in... I hope no one else has done it before ;) If you are interested, you may find the unofficial package here : http://pi= coforge.int-evry.fr/websvn/filedetails.php?repname=3Dpicoforge&path=3D%2Ftr= unk%2Flibphp-rap%2Flibphp-rap_0.9.5-1_all.deb&rev=3D0&sc=3D1=20 and the associated files (sources for the Debian package) here : http://pic= oforge.int-evry.fr/websvn/listing.php?repname=3Dpicoforge&path=3D%2Ftrunk%2= Flibphp-rap%2F&opt=3Ddir&sc=3D1 I welcome any critics or comments, of course. Best regards, P.S.: we're trying to use RAP for some RDF, DOAP, FOAF, etc processing, so = I though it could be convenient to base on a packaged version in case of de= ployment needs. --=20 Olivier BERGER <oli...@in...> (ATTENTION : new address) Ing=C3=A9nieur Recherche - Dept INF GET/INT at Evry (http://www.int-edu.eu/) OpenPGP-Id: 1024D/6B829EEC |
From: <pl...@do...> - 2007-06-29 11:35:29
|
Dear all, I've recently been working with some large datasets in RAP, persisted =20 in a MySQL database. I found when using the FindIterator class that it =20 would not scale to particularly large resultsets (e.g. =20 $dbmodel->iterFind( null, null, null ) gets proportionally quite slow =20 when you get beyond ~500 results!) After investigating the reason for =20 this, I found that the FindIterator was causing the DbModel to query =20 the database server for each iteration, advancing the offset in the =20 LIMIT clause by one each time. This has led me to write the attached MysqlFindIterator class, which =20 bypasses the RAP API, and instead queries the database directly. It =20 scales in approximately linear time, so is useful for these large =20 resultsets. At the moment I've only written it to handle MySQL =20 databases, but it should be easily modifiable for whatever DB Driver =20 you wish to use. I'd be happy for the developers to include this code or any derivative =20 work in the RAP API as bundled, if you think there's suffifcient call =20 for it :) Thanks to all, and keep up the good work! Cheers, Peter ______________________________________________________ MysqlFindIterator.class.php: <?php /* * Find Iterator operating over a MySQL Database, to operate in ~linear ti= me * Particular application in iterating over large datasets, performs faste= r * + in a more scalable manner than the existing FindIterator class. * * Author: Peter Coetzee * */ class MysqlFindIter { private $curr; private $processed; private $res; private $dbconn; private $dummy; // Pre: $dbconn is connected, and a database has been selected // Post: Prepare Iterator for operation. If $ordered =3D=3D true, // select rows ordered by subject then predicate, for ease // of processing. public function MysqlFindIter( $dbconn, $modelURI, $ordered=3Dfalse= , $sub=3Dnull, $pred=3Dnull, $obj=3Dnu= ll ) { $this->dbconn =3D $dbconn; $sql =3D "SELECT statements.* FROM statements, models " . "WHERE statements.modelID=3Dmodels.modelID AND " . "models.modelURI =3D '$modelURI'"; if ( $sub !=3D null ) $sql .=3D " AND subject =3D '$sub'"; if ( $pred !=3D null ) $sql .=3D " AND predicate =3D '$pred'"; if ( $obj !=3D null ) $sql .=3D " AND object =3D '$obj'"; if ( $ordered ) $sql .=3D " ORDER BY subject, predicate"; echo $sql; $this->res =3D mysql_query( $sql ) or die( "MySQL error: " . mysql_error ); $this->dummy =3D ModelFactory::getDefaultModel(); } // Post: Return the next statement in the Iterator public function next() { if ( $this->curr =3D=3D null && !$this->hasNext() ) return null; if ( $this->curr['object_is'] =3D=3D 'l' ) { $object =3D new Literal( $this->curr['object'] ); if ( $this->curr['l_datatype'] !=3D '' && $this->curr['l_datatype'] !=3D null ) $object->setDatatype( $this->curr['l_datatype'] )= ; } else if ( $this->curr['object_is'] =3D=3D 'b' ) { $object =3D new BlankNode( $this->dummy ); } else { $object =3D new Resource( $this->curr['object'] ); } $predicate =3D new Resource( $this->curr['predicate'] ); if ( $this->curr['subject_is'] =3D=3D 'r' ) $subject =3D new Resource( $this->curr['subject'] )= ; else $subject =3D new BlankNode( $this->dummy ); $this->curr =3D null; return new Statement( $subject, $predicate, $object ); } // Post: True iff there is another Statement in the Iterator public function hasNext() { return $this->curr =3D=3D null ? $this->curr =3D mysql_fetch_assoc( $this->res ) : t= rue; } // Post: Answer the number of Statements in the Iterator public function size() { return mysql_num_rows( $this->res ); } // Post: Free up resources used by this Iterator. Behaviour of any // subsequent calls is undefined. public function free() { mysql_free_result( $this->res ); } } ?> |