#!/usr/bin/env ruby # RDF query (in memory version), Dan Brickley require 'squish' require 'basicrdf' def shortname (uri) uri = uri.to_s uri.gsub!('http://www.w3.org/1999/02/22-rdf-syntax-ns#', 'rdf:') uri.gsub!(/http:\/\/www.w3.org\/2000\/01\/rdf-schema#/, 'rdfs:') return uri end vdl = Loader.ntfile2graph 'rdf_vdl.nt' FOAF = vdl.reg_xmlns 'http://xmlns.com/foaf/0.1/', 'foaf' DC = vdl.reg_xmlns 'http://purl.org/dc/elements/1.1/', 'dc' RDF = vdl.reg_xmlns 'http://www.w3.org/1999/02/22-rdf-syntax-ns#','rdf' VDL = vdl.reg_xmlns 'http://www.w3.org/2000/01/rdf-schema#','vdl' s1=Statement.new (nil, RDF+'type', VDL+'Class') s2=Statement.new (nil, RDF+'type', RDF+'Property') classes = vdl.ask s1 props = vdl.ask s2 puts "#Redirects for known property and class names:" puts "# (generated by $Id: apacheconf.rb,v 1.1 2003-03-01 18:08:38 danbri Exp $)" classes.subjects.each do |classuri| name=classuri.to_s.gsub!(/http:\/\/xmlns.com/,"") puts "RedirectTemp #{name} http://xmlns.com/foaf/0.1/\n" end props.subjects.each do |propuri| name=propuri.to_s.gsub!(/http:\/\/xmlns.com/,"") puts "RedirectTemp #{name} http://xmlns.com/foaf/0.1/\n" end