<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<?vsp
--
--  $Id$
--
--  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
--  project.
--
--  Copyright (C) 1998-2012 OpenLink Software
--
--  This project is free software; you can redistribute it and/or modify it
--  under the terms of the GNU General Public License as published by the
--  Free Software Foundation; only version 2 of the License, dated June 1991.
--
--  This program is distributed in the hope that it will be useful, but
--  WITHOUT ANY WARRANTY; without even the implied warranty of
--  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
--  General Public License for more details.
--
--  You should have received a copy of the GNU General Public License along
--  with this program; if not, write to the Free Software Foundation, Inc.,
--  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
--
--

   declare _G, _S, _P, _O, odd_position any;
   declare _resource_, project_name, project_home_page any;
   declare page_resource_uri, rdf_link, label, _subject any;
   declare req_url_esc any;

   -- INIT VALLUES

   _resource_ := get_keyword ('res', params, '');
   _resource_ := replace (_resource_, '/resource_vsp/', '', 1);
   _resource_ := 'http://dbpedia.openlinksw.com' || _resource_;
   req_url_esc := string_output();

   project_name := 'dbpedia.openlinksw.com';
   project_home_page := 'http://dbpedia.openlinksw.com/wikicompany';
   page_resource_uri := _resource_;
   http_url (sprintf ('<%S>', page_resource_uri), 0, req_url_esc);
   req_url_esc := string_output_string (req_url_esc);
   rdf_link := 'http://dbpedia.org:8890/sparql?default-graph-uri=http%3A%2F%2Fdbpedia.org&query=DESCRIBE+' || req_url_esc;

   dbg_obj_print (page_resource_uri);

-- HACK properties !!!

   if (strstr (page_resource_uri, 'http://dbpedia.openlinksw.com/property') = 0)
	{
	   page_resource_uri := replace (page_resource_uri,
		'http://dbpedia.openlinksw.com/property', 'http://dbpedia.org/property');
   	   project_home_page := 'http://dbpedia.org';
	}

-- HACK resource !!!

   if (strstr (page_resource_uri, 'http://dbpedia.openlinksw.com/resource') = 0)
	{
	   page_resource_uri := replace (page_resource_uri,
		'http://dbpedia.openlinksw.com/resource', 'http://dbpedia.org/resource');
   	   project_home_page := 'http://dbpedia.org';
	}


   _G := DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE (project_home_page);
   _S := DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE (page_resource_uri);
   _P := DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE (page_resource_uri);
   _O := DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE (page_resource_uri);
   odd_position := 0;

   set http_charset='utf-8';
   set isolation = 'serializable';
   http_header ('Cache-Control: no-cache, must-revalidate\r\nPragma: no-cache\r\n');
   http_header (sprintf ('Expires: %s\r\n', date_rfc1123 (dateadd ('day', 1, now ()))));


   if (exists (select 1 from DB.DBA.RDF_QUAD where S = _S and G = _G and P = DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE ('http://www.w3.org/2000/01/rdf-schema#label')))
    select O into label from DB.DBA.RDF_QUAD where S = _S and G = _G and
	P = DB.DBA.RDF_MAKE_IID_OF_QNAME_SAFE ('http://www.w3.org/2000/01/rdf-schema#label');
   else
     label := '';

   if (__tag (label) = 246) label := DB.DBA.RDF_SQLVAL_OF_OBJ (label);

   dbg_obj_print (' page_resource_uri www ', page_resource_uri, '   ', project_home_page);
?>

<!-- header -->
<head>
    <title><?=_resource_?> | <?=project_name?></title>
    <link rel="alternate" type="application/rdf+xml" href="<?=rdf_link?>" title="RDF" />
    <link rel="stylesheet" type="text/css" href="http://dbpedia.org/statics/style_w.css" />
    <link href="http://dbpedia.org/statics/highlighter.css" type="text/css" rel="stylesheet" charset="utf-8">
    <script type="text/javascript" src="http://dbpedia.org/statics/script.js"></script>
</head>
  <body onLoad="init();">
    <div id="header">
      <div>
        <h1 id="title"><?=label?></h1>
       <div id="homelink"></div>
      </div>
      <div class="page-resource-uri">
	<label class="ds_uri">Data Source Name (URI): </label>
	<a title="A Data Source Name, Entity ID, or URI that exposes the location of the Description of this Resource" href="<?=replace (page_resource_uri, 'http://dbpedia.org', 'http://dbpedia.org:8890')?>"><?=page_resource_uri?></a>
      </div>
      <div id="rdficon"><a href="<?=rdf_link?>" title="RDF data">
	<img src="http://dbpedia.org/statics/sw-rdf-gray.png" alt="[RDF Data]"></a>
      </div>
    </div>

<!-- proptable -->
<table class="description"><tr><th width="25%">Property</th><th>Value</th></tr>

<?vsp

      for (select distinct P as PRED from DB.DBA.RDF_QUAD where S = _S and G = _G order by id_to_iri (P)) do
	{
	   dbp_ldd_http_print_l_white (id_to_iri (PRED), odd_position);
	   for (select O as OBJECT from DB.DBA.RDF_QUAD where S = _S and G = _G and P = PRED) do
		dbp_ldd_http_print_r_white (OBJECT);

	   http ('</ul></td></tr>');
	}

      for (select distinct P as PRED from DB.DBA.RDF_QUAD where O = _O and G = _G order by id_to_iri (P)) do
	{
	   dbp_ldd_http_print_l_white (id_to_iri (PRED), odd_position, 1);
	   for (select S as OBJECT from DB.DBA.RDF_QUAD where O = _O and G = _G and P = PRED) do
		dbp_ldd_http_print_r_white (OBJECT);
	   http ('</ul></td></tr>');
	}

       if  (odd_position = 0)
	 {
	    http ('<tr><td colspan="2"><p>No further information is available.</p></td></tr>');
	 }

?>
      </table>

<!-- footer -->
<div id="footer">
      This page shows information obtained from the SPARQL endpoint at
        <a class="sparql-uri" href="http://dbpedia.org/sparql"> http://dbpedia.org/sparql </a> or
	<a class="sparql-uri" href="http://dbpedia.org:8890/sparql">http://dbpedia.org:8890/sparql</a>.<br>

      <a href="http://linkeddata.org/"><img style="vertical-align: -3px;" alt="This material is Open Knowledge" src="http://dbpedia.org/statics/LoDLogo.gif" border="0"></a> &nbsp;
      Browse using: 
      <a href="http://demo.openlinksw.com/rdfbrowser2/?uri=<?vsp http_url (page_resource_uri); ?>">OpenLink Data Explorer</a> |
      <a href="http://dataviewer.zitgist.com/?uri=<?vsp http_url (page_resource_uri); ?>">Zitgist Data Viewer</a> |
      <a href="http://beckr.org/marbles?uri=<?vsp http_url (page_resource_uri); ?>">Marbles</a> |
      <a href="http://www4.wiwiss.fu-berlin.de/rdf_browser/?browse_uri=<?vsp http_url (page_resource_uri); ?>">DISCO</a> |
      <a href="http://dig.csail.mit.edu/2005/ajar/release/tabulator/0.8/tab.html?uri=<?vsp http_url (page_resource_uri); ?>">Tabulator</a>
      &nbsp; &nbsp; Raw Data in:
      <a href="<?=rdf_link || '&output=n3'?>">N3</a> |
      <a href="<?=rdf_link || '&output=xml'?>">RDF/XML</a>
      &nbsp; &nbsp;<a href="http://wiki.dbpedia.org/Imprint">Contact</a>&nbsp; &nbsp;
      <a href="http://www.opendefinition.org/"><img style="vertical-align: -3px;" alt="This material is Open Knowledge" src="http://dbpedia.org/statics/od_80x15_red_green.png" border="0"></a>
    </div>

    <div id="rdficon">
      <a href="http://virtuoso.openlinksw.com" title="OpenLink Virtuoso"><img class="powered_by" src="http://dbpedia.org/statics/virt_power_no_border.png" alt="Powered by OpenLink Virtuoso"/></a>
    </div>

    <div>
    </div>

   </td></tr>
 </div>
<!-- footer -->


 </body>
</html>
