|
From: Eric F. <fel...@gm...> - 2009-11-22 18:42:43
|
ACTION:
request a URL http://localhost/triplify/index.php/academicstaff/John+Doe
on triplify 0.7, with $triplify['LinkedDataDepth']==2
BEHAVIOUR:
The request returns no data on 'John Doe' (only license-part and
provenance meta-data).
EXPECTED BEHAVIOR:
The request returns the license-part, all data on "John Doe", and metadata.
FIX:
Change line 143 of index.php (which was introduced in v0.5) from:
if(($cols && $cols!='*') || $group)
to:
if($cols || $group)
If you now request
http://localhost/triplify/index.php/academicstaff/John+Doe , then $id
is specified ('John Doe'), so line 142 sets $cols='*'.
Line 144 cleverly builds a nested query:
$query="SELECT $cols FROM ($query) t WHERE '1'".$group;
which results in:
SELECT * FROM (SELECT name AS id,
name AS 'foaf:name',
office AS 'vocabulary:office',
position AS 'vocabulary:position',
email AS 'foaf:mbox',
CONCAT('tel:',phone) AS 'foaf:phone'
FROM academicStaff) t WHERE '1' AND id='John Doe'
Notice the WHERE trick Davide suggested is then applied in line 144,
and the "AND id='John Doe'" part is appended by line 152. The result
is now as expected: All triples with John Doe as subject are returned.
Cheers,
Eric
On Sat, Nov 21, 2009 at 9:09 PM, Davide Ceolin <dav...@gm...> wrote:
>
> Hi all,
> maybe I found a bug: invoking
> http://localhost/index.php/user/1
> I received this output:
>
> <http://localhost/triplify/index.php/user/1> <http://www.w3.org/2000/01/rdf-schema#comment> "Generated by Triplify V0.7 (http://Triplify.org)" .
> <http://localhost/triplify/index.php/user/1> <http://creativecommons.org/ns#license> <http://creativecommons.org/licenses/by/3.0/us/> .
> <> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/net/provenance/ns#DataItem> .
> <> <http://purl.org/net/provenance/ns#createdBy> _:x2 .
> _:x2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/net/provenance/ns#DataCreation> .
> _:x2 <http://purl.org/net/provenance/ns#performedAt> "2009-11-21T20:38:46+01:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
> _:x2 <http://purl.org/net/provenance/ns#performedBy> _:x1 .
> _:x2 <http://purl.org/net/provenance/ns#usedData> _:x3 .
>
> [...]
>
> This meant that I could not see the data, although $triplify['LinkedDataDepth']='2'; .
>
> This was because the query produced by index.php was something like:
>
> SELECT id,name AS 'foaf:firstname', SHA(CONCAT('mailto:',email)) AS 'foaf:mbox_sha1sum' FROM demo AND id='1'
>
> Therefore I changed line 159 in:
>
> $query=$query." WHERE 1".($id?' AND '.(is_numeric($qid)?'id':$qid).'='.$this->dbQuote(urldecode($id)):'').
> (preg_match('/^[A-Za-z0-9: ,]+?$/',$_GET['t-order'])?' ORDER BY '.$_GET['t-order']:'').
> ($start||$erg?' LIMIT '.($start?$start.','.($erg?$erg:20):$erg):'');
>
> and now the result is:
>
> <http://localhost/triplify/index.php/user/1> <http://www.w3.org/2000/01/rdf-schema#comment> "Generated by Triplify V0.7 (http://Triplify.org)" .
> <http://localhost/triplify/index.php/user/1> <http://creativecommons.org/ns#license> <http://creativecommons.org/licenses/by/3.0/us/> .
> <http://localhost/triplify/index.php/user/1> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://xmlns.com/foaf/0.1/person> .
> <http://localhost/triplify/index.php/user/1> <http://xmlns.com/foaf/0.1/firstname> "davide" .
> <http://localhost/triplify/index.php/user/1> <http://xmlns.com/foaf/0.1/mbox_sha1sum> "047529160d1b5e60d0d83ddd58c77c5b5bc40c28" .
> <> <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/net/provenance/ns#DataItem> .
> <> <http://purl.org/net/provenance/ns#createdBy> _:x2 .
> _:x2 <http://www.w3.org/1999/02/22-rdf-syntax-ns#type> <http://purl.org/net/provenance/ns#DataCreation> .
> _:x2 <http://purl.org/net/provenance/ns#performedAt> "2009-11-21T20:38:46+01:00"^^<http://www.w3.org/2001/XMLSchema#dateTime> .
> _:x2 <http://purl.org/net/provenance/ns#performedBy> _:x1 .
> _:x2 <http://purl.org/net/provenance/ns#usedData> _:x3 .
>
> [...]
>
> I don't know whether it is the right place where to put " WHERE 1" since I could not check all backsides.
>
> Cheers,
>
> Davide
>
> ------------------------------------------------------------------------------
> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
> trial. Simplify your report design, integration and deployment - and focus on
> what you do best, core application coding. Discover what's new with
> Crystal Reports now. http://p.sf.net/sfu/bobj-july
> _______________________________________________
> Triplify-discussion mailing list
> Tri...@li...
> https://lists.sourceforge.net/lists/listinfo/triplify-discussion
>
|