<% if (Request.QueryString('url')+''!='undefined') qs=Request.QueryString('url') else qs=unescape(Request.ServerVariables("QUERY_STRING")) xmlhttp=Server.CreateObject("MSXML2.ServerXMLHTTP") xml=new ActiveXObject ("Microsoft.XMLDOM"); xml.async=false xml.validateOnParse=false xml.resolveExternals=false /* AnnoteaServer="http://iggy.w3.org/annotations" xmlhttp=Server.CreateObject("MSXML2.ServerXMLHTTP") xmlhttp.open("GET",AnnoteaServer+"?w3c_annotates="+qs,false) xmlhttp.setRequestHeader("Accept","text/xml") xmlhttp.setRequestHeader("user-agent","Image+Annotation+Client"); xmlhttp.send() myRDF=new RDF() myRDF.loadRDFXML(xmlhttp.responseText) body=myRDF.Match(null,null,'http://www.w3.org/2000/10/annotation-ns#body',null) */ Response.contentType="application/xml" xml=Server.CreateObject("Microsoft.XMLDOM") // Extract XMP data from cited image using danbris service. // Dodgy Hack to make rdf:About be about the image I requested, // this could be wrong of course xmlhttp.open("GET","http://www.w3.org/2001/sw/Europe/200206/imagemeta/extract/extract?uri="+qs+"&html=false",false) xmlhttp.setRequestHeader("user-agent","Image+Annotation+Client"); xmlhttp.send() if (xmlhttp.responseText.indexOf('ESW: XMP Extractor Demo')==-1) xml.loadXML(xmlhttp.responseText) try { xml.selectSingleNode('//rdf:Description').attributes.getNamedItem('rdf:about').nodeValue=qs } catch (e) {} /* for (i=0;i=0;j--) { if (xml2.documentElement.childNodes[j].attributes.getNamedItem('rdf:about').nodeValue!="") xml.documentElement.appendChild(xml2.documentElement.childNodes[j]) } } } else { xml.loadXML(xmlhttp.responseText) } } */ Response.Write(xml.xml) function RDF() { RDF_NS="http://www.w3.org/1999/02/22-rdf-syntax-ns#" rdfNS="" GlobalID=0 genids=[] inTriples=new Array() Namespaces=new Array() xml=null this.Match=Match this.getSingleObject=SingleObject this.getSingleObjectResource=SingleObjectResource this.toNTriples=outputNTriples this.getRDFURL=getRDF this.getRDFURLNTriples=getRDF_NT this.loadRDFXML=_loadRDFXML this.getTriples=function() { return inTriples } callbackfn=null function getRDF(url,func) { callbackfn=func getURL(url,ReturnRDF) } function getRDF_NT(url,func) { callbackfn=func getURL(url,ReturnRDF_NT) } function ReturnRDF(obj) { if (typeof parseXML=='undefined') { xml=new ActiveXObject ("Microsoft.XMLDOM"); xml.async=false xml.validateOnParse=false xml.resolveExternals=false xml.loadXML(obj.content) } else { xml=parseXML(obj.content,null) } GetTriples() callbackfn() } function ReturnRDF_NT(obj) { str=obj.content.split('.\n') for (var i=0;i2) { var subj=tris[0] subj=subj.split('<')[1].split('>')[0] var pred=tris[1] pred=pred.split('<')[1].split('>')[0] obj=str[i].substr(str[i].indexOf(pred+'> ')+pred.length+2,str[i].length) if (obj.indexOf('<')==0) { obj=obj.split('<')[1].split('>')[0] inTriples.push(new Triple(subj,pred,obj,"resource")) } else { obj=obj.split('"')[1].split('"')[0] inTriples.push(new Triple(subj,pred,obj,"literal")) } } } callbackfn() } function _loadRDFXML(xmltxt) { xml=new ActiveXObject ("Microsoft.XMLDOM"); xml.async=false xml.validateOnParse=false xml.resolveExternals=false xml.loadXML(xmltxt) GetTriples() } function GetTriples(url) { getNamespaces(xml.documentElement) createPredicates(xml.documentElement.childNodes) for (i=0;i '; str+='<'+inTriples[i].predicate+'> ' if (inTriples[i].type=='literal') str+='"'+inTriples[i].object+'"' else if (inTriples[i].object && inTriples[i].object.indexOf('genid')==0) str+='_:n'+inTriples[i].object.substr(6)+'' else str+='<'+inTriples[i].object+'>' str+='.\n' } return str } function createPredicates(els) { var el,i,j,attr,nn,nv,attr,ns for (i=0;i '; str+='<'+this[i].predicate+'> ' if (this[i].type=='literal') str+='"'+this[i].object+'"' else if (this[i].object && this[i].object.indexOf('genid')==0) str+='_:n'+this[i].object.substr(6)+'' else str+='<'+this[i].object+'>' str+='.\n' } return str } Array.prototype.toNTriplesExpand=function(rdf) { str='' for (i=0;i '; str+='<'+this[i].predicate+'> ' if (this[i].type=='literal') str+='"'+this[i].object+'"' else if (this[i].object && this[i].object.indexOf('genid')==0) { str+='_:n'+this[i].object.substr(6)+'' str+=rdf.Match(null,this[i].object,null,null).toNTriplesExpand(rdf) } else str+='<'+this[i].object+'>' str+='.\n' } return str } function HTTP() { var xmlhttp xmlhttp=Server.CreateObject("MSXML2.ServerXMLHTTP") return xmlhttp } if (typeof getURL=='undefined') { getURL=function(url,fn) { var xmlhttp=new HTTP(); if (xmlhttp) { xmlhttp.open("GET",url,true); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { fn({status:xmlhttp.status,content:xmlhttp.responseText, contentType:xmlhttp.getResponseHeader("Content-Type")}) } } xmlhttp.send() } else { //Some Appropriate Fallback... } } } if (typeof postURL=='undefined') { postURL=function(url,txt,fn,type,enc) { var xmlhttp=new HTTP(); if (xmlhttp) { xmlhttp.open("POST",url,true,'test','test'); if (enc) xmlhttp.setRequestHeader("Content-Encoding",enc) if (type) xmlhttp.setRequestHeader("Content-Type",type) xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4) { fn({status:xmlhttp.status,content:xmlhttp.responseText, contentType:xmlhttp.getResponseHeader("Content-Type")}) } } xmlhttp.send(txt) } else { //Some Appropriate Fallback... } } } %>