Changeset 637


Ignore:
Timestamp:
May 28, 2005, 9:26:18 PM (17 years ago)
Author:
Earle Martin
Message:

add owl:sameAs property to RDF versions of redirecting nodes

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r636 r637  
    1010            category/locale listings to facilitate integration with mapping
    1111            applications.
    12         Reorder navigation bar to provide more logical groupings.
     12          Added owl:sameAs property to RDF output for nodes that are redirects
     13            to other nodes.
     14        Reorder navigation bar to provide more logical groupings.
    1315        Add "format=plain" option for all-nodes index listing and associated
    1416          template plain_index.tt.
  • trunk/lib/OpenGuides/RDF.pm

    r636 r637  
    206206    xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
    207207    xmlns:os="http://downlode.org/rdf/os/0.1/"
     208    xmlns:owl="http://www.w3.org/2002/07/owl#"
    208209    xmlns="http://www.w3.org/2000/10/swap/pim/contact#"
    209210  >
     
    253254    $rdf .= "    <chefmoz:Hours>$opening_hours_text</chefmoz:Hours>\n" if $opening_hours_text;
    254255
    255     $rdf .= qq{
    256   </$objType>
     256    if ($node_data{content} =~ /^\#REDIRECT \[\[(.*?)]\]$/)
     257    {
     258      my $redirect = $1;
     259     
     260      $rdf .= qq{    <owl:sameAs rdf:resource="} . $self->{config}->script_url
     261      . uri_escape($self->{config}->script_name) . '?id='
     262      . uri_escape($wiki->formatter->node_name_to_node_param($redirect))
     263      . ';format=rdf#obj';
     264      $rdf .= qq{" />\n};
     265
     266    }
     267   
     268    $rdf .= qq{  </$objType>
    257269</rdf:RDF>
    258270
  • trunk/t/21_rdf.t

    r636 r637  
    66use OpenGuides::Test;
    77use URI::Escape;
    8 use Test::More tests => 24;
     8use Test::More tests => 25;
    99
    1010eval { require DBD::SQLite; };
     
    126126    like( $rdfxml, qr|<wiki:version>0</wiki:version>|,
    127127          "...and wiki:version is 0" );
     128
     129    # Test the data for a node that redirects.
     130    $wiki->write_node( "Calthorpe Arms Pub",
     131                       "#REDIRECT [[Calthorpe Arms]]",
     132                       undef,
     133                       {
     134                         comment            => "Created as redirect to Calthorpe Arms page.",
     135                         username           => "Earle",
     136                       }
     137    );
     138
     139    my $redirect_rdf = $rdf_writer->emit_rdfxml( node => "Calthorpe Arms Pub" );
     140
     141    like( $redirect_rdf, qr|<owl:sameAs rdf:resource="/\?id=Calthorpe_Arms;format=rdf#obj" />|,
     142          "redirecting node gets owl:sameAs to target" );
     143
    128144}
Note: See TracChangeset for help on using the changeset viewer.