Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 54 lines (38 sloc) 1.232 kb
4323fa7e »
2009-03-24 Initial version
1 <?php
2 $inchi = substr($_SERVER['REQUEST_URI'],2);
3
4 print "<!-- $inchi -->\n";
5
6 $pos = strpos($inchi, 'info:inchi/');
7 if ($pos === 0) {
8 $inchi = substr($inchi, 11);
9 }
10
11 print "<!-- $inchi -->\n";
12
13 if (strlen($inchi) === 0) {
14 $inchi = "InChI=1/CH4/h1H4";
15 }
e72a3636 »
2010-02-24 Sanatize InChI input
16 if (strlen($inchi) < 8 ||
17 (substr($inchi, 0,8) != "InChI=1/" &&
18 substr($inchi, 0,9) != "InChI=1S/")) {
19 $inchi = "InChI=1/CH4/h1H4";
20 }
4323fa7e »
2009-03-24 Initial version
21 ?>
22
23 <rdf:Description
24 xmlns:owl="http://www.w3.org/2002/07/owl#"
25 rdf:about="http://rdf.openmolecules.net/?<?php echo $inchi;?>">
26
27 <dc:source>DBPedia</dc:source>
28
29 <?
30
31 $paper_id = false;
32
33 $safe_inchi = mysql_escape_string($inchi);
34
35 if ($safe_inchi) {
36 echo "<!-- DEBUG: inchi=".$safe_inchi." -->\n";
37 $query = "SELECT SQL_CALC_FOUND_ROWS * FROM dbpedia ";
38 $where_clause = "WHERE inchi = '$safe_inchi'";
39
40 $query = $query.$where_clause;
41
b6481d4d »
2009-05-08 Removed unwanted HTML elements
42 print "<!-- DEBUG: query = $query -->\n";
4323fa7e »
2009-03-24 Initial version
43 $results = mysql_query($query);
44
45 $rows = mysql_num_rows($results);
46 while ($row = mysql_fetch_assoc($results)) {
47 print "<owl:sameAs rdf:resource=\"".$row['dbresource']."\"/>\n";
48 }
49 }
50
51 ?>
52
53 </rdf:Description>
Something went wrong with that request. Please try again.