<% // http://localhost/gedcom/gedcom.1?obj=http%3A%2F%2Fwww.alternation.net%2Fged2foaf%2FI0147.xml%23I0147 output=[]; RS = Server.CreateObject("ADODB.Recordset"); obj=(Request.QueryString('obj')+'').replace(new RegExp("'","gim"),"-"); //' RSC=new ActiveXObject("ADODB.Connection"); RSC.Open("rdf"); Type="http://jibbering.com/foaf/jim.rdf#Unknown" Name="Unknown" if (obj=='undefined' || obj=='') { obj="http://www.alternation.net/ged2foaf/I0147.xml#I0147"; } sqlstr="select obj from gedcom3 where subj='"+obj+"' and pred='http://www.w3.org/1999/02/22-rdf-syntax-ns#type' limit 1"; RS.Open(sqlstr,RSC); if (!RS.EOF) { Type=RS.Fields(0).Value; } sqlstr="select obj from gedcom3 where subj='"+obj+"' and (pred='http://xmlns.com/foaf/0.1/name' or pred='http://www.w3.org/2000/01/rdf-schema#Label') limit 1"; try { RS.Close() } catch (E) {}; RS.Open(sqlstr,RSC); if (!RS.EOF) { Name=RS.Fields(0).Value; } if (Type=="http://xmlns.com/foaf/0.1/Group") { // It's a Family queryObj=obj; query2="subj"; query1="obj"; pred="member"; otherType="http://xmlns.com/foaf/0.1/Person" start=""; end=""; } else { // It's a Person queryObj=obj; query2="obj"; query1="subj"; pred="member"; start=""; otherType="http://xmlns.com/foaf/0.1/Group"; end=""; } sqlstr="select distinct "+query1+",pred from gedcom3 where "+query2+"='"+queryObj+"' and pred='http://xmlns.com/foaf/0.1/"+pred+"'"; try { RS.Close() } catch (E) {}; RS.Open(sqlstr,RSC); if (!RS.EOF) { objects=RS.getRows().toArray(); var objL=objects.length/2; for (i=0;i'); objects.splice(0,2); } } sqlstr="select distinct obj,pred from gedcom3 where subj='"+queryObj+"' and pred like 'http://purl.org/vocab/relationship/%'"; try { RS.Close() } catch (E) {}; RS.Open(sqlstr,RSC); if (!RS.EOF) { objects=RS.getRows().toArray(); var objL=objects.length/2; for (i=0;i'); objects.splice(0,2); } } if (Type=="http://xmlns.com/foaf/0.1/Group") { output.push('Family'); } else { sqlstr="select obj from gedcom3 where subj='"+obj+"' and pred='http://xmlns.com/foaf/0.1/gender' limit 1"; try { RS.Close() } catch (E) {}; RS.Open(sqlstr,RSC); if (!RS.EOF) { gender=RS.Fields(0).Value.toLowerCase(); if (gender=="male") { start=""; end=""; } if (gender=="female") { start=""; end=""; } } } Response.ContentType="text/xml"; %> <% Response.Write(start); Response.Write(''+obj+''); Response.Write(''+Name+''); Response.Write(output.join('')); Response.Write(end); %>