r400 - in zope-rdfgrabber/trunk: . debian
Jonas Meurer
mejo at alioth.debian.org
Wed Nov 1 22:20:19 CET 2006
Author: mejo
Date: 2006-11-01 22:20:19 +0100 (Wed, 01 Nov 2006)
New Revision: 400
Removed:
zope-rdfgrabber/trunk/DumbDown.py
zope-rdfgrabber/trunk/RDFGrabber.py
zope-rdfgrabber/trunk/README.txt
zope-rdfgrabber/trunk/__init__.py
zope-rdfgrabber/trunk/add_grabber.dtml
zope-rdfgrabber/trunk/const.py
zope-rdfgrabber/trunk/edit_prop.dtml
zope-rdfgrabber/trunk/examples/
zope-rdfgrabber/trunk/htmlview.dtml
zope-rdfgrabber/trunk/objects.py
zope-rdfgrabber/trunk/parsed.dtml
zope-rdfgrabber/trunk/rdf.gif
zope-rdfgrabber/trunk/rdfparser.py
zope-rdfgrabber/trunk/results.dtml
zope-rdfgrabber/trunk/source.dtml
zope-rdfgrabber/trunk/testparser.py
zope-rdfgrabber/trunk/version.txt
Modified:
zope-rdfgrabber/trunk/debian/changelog
zope-rdfgrabber/trunk/debian/compat
zope-rdfgrabber/trunk/debian/control
Log:
clean up trunk
Deleted: zope-rdfgrabber/trunk/DumbDown.py
===================================================================
--- zope-rdfgrabber/trunk/DumbDown.py 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/DumbDown.py 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,103 +0,0 @@
-def calculateDumbDown(self, property, node):
- rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
- rdfs="http://www.w3.org/1999/02/22-rdf-schema-ns#"
- dc="http://purl.org/dc/elements/1.1/"
- dct="http://purl.org/dc/terms/"
- dcq=dct # old: "http://purl.org/dc/qualifiers/1.0/"
- # care about cycles:
- if visitedHash==None:
- visitedHash={}
- #
- if node.is_literal():
- return node
- else:
- if property == (dc + "identifier")\
- or property == (dc + "reference")\
- or property == (dc + "source"):
- # preferably calculate a URI
- # Bag or Seq ?:
- if isinstance(node, rdf + "Bag") or
- isinstance(node, rdf + "Seq"):
- return self.processBag_Seq(property,node,visitedHash)
-
- # Alt ?
- if isinstance(node, rdf+"Alt"):
- return self._processAlt(property,node,visitedHash)
-
- # URI ?
- if(node.getLabel != ""):
- return (node.getLabel)
-
- # rdfs:label ?
- label=node.getChildsByProperty(rdfs+"label")
- if label:
- return map _.getLabel label
-
- # has rdf:value?
- rdfvalue=node.getChildsByProperty(rdf+"value")
- if rdfvalue:
- return self._process_rdf_value(property,visitedHash,rdfvalue)
-
- # else: do nothing!
- return None
- else:
- # rdfs:label ?
- label=node.getChildsByProperty(rdfs+"label")
- if label:
- return map _.getLabel label
-
- # has rdf:value?
- rdfvalue=node.getChildsByProperty(rdf+"value")
- if rdfvalue:
- return self._process_rdf_value(property,visitedHash,rdfvalue)
-
- # Bag or Seq ?:
- if isinstance(node, rdf+"Bag") or\
- isinstance(node, rdf+"Seq"):
- return self._processBag_Seq(property,node,visitedHash)
-
- # Alt ?
- if isinstance(node, rdf+"Alt"):
- return self._processAlt(property,node,visitedHash)
-
- # has dc:title?
- title=node.getChildsByProperty(dc+"title")
- if title:
- return self._process_rdf_value(property,visitedHash,title)
-
- # URI ?
- if(node.getLabel != ""):
- return (node.getLabel)
-
- # else: do nothing!
- return None
-
-def _processBag_Seq (self,property,node,visitedHash):
- elements=node.rdfPath('element()')
- res=""
- for each elem(elements):
- res += (elem.getLabel + ";")
- if isinstance(elem, 'Literal')
- if isinstance(elem, 'Resource'):
- res=res.join(' ',self._calculateDumbDown(property,elem,visitedHash))
- res=~s/\\s//
- return (res)
-
-def _processAlt (self,property,node,visitedHash):
- elements = node.rdfPath('element()')
- erg = None
- for each elem(elements):
- push erg,elem.getLabel
- if isinstance(elem, 'Literal')
- if isinstance(elem, 'Resource'):
- push erg,self._calculateDumbDown(property,elem,visitedHash)
- return erg
-
-def _process_rdf_value (self,property,visitedHash,rdfvalue):
- erg = None
- for each elem(rdfvalue):
- push erg,elem.getLabel
- if isinstance(elem, 'Literal')
- if isinstance(elem, 'Resource'):
- push erg,self._calculateDumbDown(property,elem,visitedHash)
- return erg
Deleted: zope-rdfgrabber/trunk/RDFGrabber.py
===================================================================
--- zope-rdfgrabber/trunk/RDFGrabber.py 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/RDFGrabber.py 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,456 +0,0 @@
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-#
-# The Original Code is RDFGrabber version 1.0.
-#
-# The Initial Developer of the Original Code is European Environment
-# Agency (EEA). Portions created by EEA are
-# Copyright (C) European Environment Agency. All
-# Rights Reserved.
-#
-# Contributor(s):
-# Soren Roug, EEA
-# Tomas Hjelmberg, CMG
-#
-
-# Here we put the Zope class stuff
-# Zope imports
-from DateTime import *
-import Globals
-from Globals import Persistent, Acquisition
-import OFS
-import AccessControl
-
-import binascii,md5
-import rdfparser, objects
-
-import pickle, types, os, string, re
-from os.path import join, isfile
-
-_repos = join(CLIENT_HOME, 'RDFGrabber')
-
-fixslash = string.maketrans('/','-')
-
-class SPO:
- # Allow (reluctantly) access to unprotected attributes
- __allow_access_to_unprotected_subobjects__=1
-
- def __init__(self, subject,predicate,object):
- self._subject = subject
- self._predicate = predicate
- self._object = object
-
- def strsubject(self):
- return str(self._subject)
- def strpredicate(self):
- return str(self._predicate)
- def strobject(self):
- return str(self._object)
-
- def subject(self):
- return self._subject
- def predicate(self):
- return self._predicate
- def object(self):
- return self._object
-
-class RDFGrabber (
- Acquisition.Implicit,
- Persistent,
- AccessControl.Role.RoleManager,
- OFS.SimpleItem.Item):
- "Retrieve RDF from other websites."
-
- __ac_permissions__=(
- ('View management screens', ('manage_main',)),
- ('View', ('', 'index_html', 'update','dumbdown',
- 'query', 'query_html', 'show_source','label_of',
- 'rdfsources',
- )),
- ('Change RDFGrabbers', ('manage_edit',), ('Manager',)),
- )
-
- manage_options=(
- {'label':'Properties', 'action':'manage_main'},
- {'label':'Query', 'action':'query_html'},
- {'label':'Triples', 'action':'triples_html'},
- {'label':'Update', 'action':'update'},
- {'label':'Source', 'action':'show_source'},
- ) + OFS.SimpleItem.SimpleItem.manage_options
-
- meta_type = 'RDF Grabber'
-
- triples_html = Globals.DTMLFile("htmlview", globals())
- show_source = Globals.DTMLFile("source", globals())
- manage_main = Globals.DTMLFile("edit_prop", globals())
- query_html = Globals.DTMLFile("results", globals())
- index_html = Globals.DTMLFile("index_html", globals())
-
- def rdfsources(self,key):
- "Returns a dictionary of sources where the key is the url"
- return self._v_rdfsources[key]
-
- def lastupdated(self):
- return self._v_updatedate
-
- def triples(self):
- return self._v_triples
-
- def subjects(self):
- return self._v_subjects
-
- def predicates(self):
- return self._v_predicates
-
- def objects(self):
- return self._v_objects
-
- def filename(self):
- return self._filename
-
- def lookup_subject(self,subject):
- if not self._v_subjects.has_key(str(subject)):
- return []
- return self._v_subjects[str(subject)]
-
- def lookup_predicate(self,predicate):
- if not self._v_predicates.has_key(str(predicate)):
- return []
- return self._v_predicates[str(predicate)]
-
- def lookup_object(self,object):
- if not self._v_objects.has_key(str(object)):
- return []
- return self._v_objects[str(object)]
-
- def query(self,subject=None,predicate=None,object=None,onehit=None):
- "Search triples that match the query"
- res = []
- try:
- if subject:
- tmp = self._v_subjects[str(subject)]
- subject=None
- elif predicate:
- tmp = self._v_predicates[str(predicate)]
- predicate=None
- elif object:
- tmp = self._v_objects[str(object)]
- object=None
- else:
- if onehit:
- return self._v_triples[0]
- else:
- return self._v_triples
- except:
- tmp = []
-
- for x in tmp:
- c = x
- if subject and str(subject) != str(x.subject()):
- c = None
- if c and predicate and str(predicate) != str(c.predicate()):
- c = None
- if c and object and str(object) != str(c.object()):
- c = None
- if c:
- res.append(c)
-
-# if self._v_subjects.has_key(str(subject)):
-# for x in self._v_subjects[str(subject)]:
-# if str(x.predicate()) == str(predicate):
-# res.append(x)
- if onehit:
- if len(res) > 0:
- return res[0]
- else:
- return None
- else:
- return res
-
-
- def label_of(self,predicate):
- """Convenience to find the label for a predicate
- Assumes the RDF schema for that class has been loaded
- """
- for item in self.lookup_subject(predicate):
- if item.strpredicate() == "http://www.w3.org/2000/01/rdf-schema#label":
- return item.strobject()
- return predicate
-
- def dumbdown(self,object):
- """
- This convenience method will find follow the pointers
- (the generated identifiers) for a subject,predicate pair
- and return a list of objects when it finds
- an rdf:Bag or an rdf:value
- """
- list = []
- return self._dumbdown(self.lookup_object(str(object)),list)
-
- def _dumbdown(self,spo,list):
- for i in spo:
- if i.object().is_anonymous() is None:
- if i.strpredicate() == "http://www.w3.org/1999/02/22-rdf-syntax-ns#value" \
- or i.strpredicate()[:44] == "http://www.w3.org/1999/02/22-rdf-syntax-ns#_":
- list.append(i.strobject())
- else:
- self._dumbdown(self.lookup_subject(i.strobject()),list)
- return list
-
- def _loadpickles(self):
- try:
- f = open(self.physicalpath(self._filename), 'r')
- self._v_updatedate = pickle.load(f)
- self._v_rdfsources = pickle.load(f)
- self._v_triples = pickle.load(f)
- self._v_subjects = pickle.load(f)
- self._v_predicates = pickle.load(f)
- self._v_objects = pickle.load(f)
- f.close()
- except IOError:
- self._v_updatedate = None
- self._v_rdfsources = {}
- self._v_triples = []
- self._v_subjects = {}
- self._v_predicates = {}
- self._v_objects = {}
-
- def __init__(self, id, title, rdfurls, http_proxy):
- self.id = id
- self.title = title
- self.rdfurls = rdfurls
- self.http_proxy = http_proxy
- self._filename = ''
-
- self._v_rdfsources = {}
- self._v_updatedate = None
- self._v_triples = []
- self._v_subjects = {}
- self._v_predicates = {}
- self._v_objects = {}
-
- def __setstate__(self,state):
- Persistent.__setstate__(self,state)
-
- if not hasattr(self, "_filename"): # backwards compatibility
- self._filename = self.id
- if not hasattr(self, "rdfurls"): # backwards compatibility
- self.rdfurls = [ self.rdfurl ]
- delattr(self, "rdfurl")
- self._loadpickles()
-
- def _ICanAdd(self,subject, predicate, object):
- # Assume spo is shared in all dictionaries
- spo = SPO(subject, predicate, object)
-
- self._v_triples.append(spo)
-
- x = str(subject)
- if not self._v_subjects.has_key(x):
- self._v_subjects[x] = []
- self._v_subjects[x].append(spo)
-
- x = str(predicate)
- if not self._v_predicates.has_key(x):
- self._v_predicates[x] = []
- self._v_predicates[x].append(spo)
-
- x = str(object)
- if not self._v_objects.has_key(x):
- self._v_objects[x] = []
- self._v_objects[x].append(spo)
-
- def manage_edit(self, title, rdfurls, http_proxy, REQUEST=None):
- "Edits the grabber's characteristics"
- self.title = title
- self.rdfurls = rdfurls
- self.http_proxy = http_proxy
- return self.update(REQUEST)
-
- def update(self, REQUEST=None):
- "Call this function to get it to update its content"
- # make the directories
- if not os.path.isdir(_repos):
- try:
- os.makedirs(_repos)
- except:
- raise OSError, 'Can\'t create directory %s' % _repos
- self._v_updatedate = DateTime()
- self._v_triples = []
- self._v_subjects = {}
- self._v_predicates = {}
- self._v_objects = {}
- self._v_rdfsources = {}
- p=rdfparser.RDFParser(self._ICanAdd, http_proxy=self.http_proxy)
- for rdfurl in self.rdfurls:
- p.parse_url(rdfurl)
- self._v_rdfsources[rdfurl] = p.rdfsource
-
- fn = self.physicalpath(self._filename)
- try:
- os.rename(fn, fn+'.undo')
- except OSError:
- pass
-
- #write objects
- f = open(fn, 'w')
- pickle.dump(self._v_updatedate, f)
- pickle.dump(self._v_rdfsources, f)
- pickle.dump(self._v_triples, f)
- pickle.dump(self._v_subjects, f)
- pickle.dump(self._v_predicates, f)
- pickle.dump(self._v_objects, f)
- f.close()
-
- if REQUEST is not None:
- return Globals.MessageDialog(
- title='Updated',
- message='Content of <strong>%s</strong> has been updated.<br>' %
- self.id, action ='manage_main')
-
- def _undo(self):
- """ Restore filename after undo or copy-paste """
- if self._filename == '':
- return
- fn = self.physicalpath(self._filename)
- if not isfile(fn) and isfile(fn+'.undo'):
- os.rename(fn+'.undo', fn)
- self._loadpickles()
-
- def _copy(self, infile, outfile):
- """ read binary data from infile and write it to outfile
- infile and outfile my be strings, in which case a file with that
- name is opened, or filehandles, in which case they are accessed
- directly.
- """
- if type(infile) is types.StringType:
- try:
- instream = open(infile, 'rb')
- except IOError:
- self._undo()
- try:
- instream = open(infile, 'rb')
- except IOError:
- raise IOError, ("%s (%s)" %(self.id, infile))
- close_in = 1
- else:
- instream = infile
- close_in = 0
- if type(outfile) is types.StringType:
- try:
- outstream = open(outfile, 'wb')
- except IOError:
- raise IOError, ("%s (%s)" %(self.id, outfile))
- close_out = 1
- else:
- outstream = outfile
- close_out = 0
- try:
- blocksize = 2<<16
- block = instream.read(blocksize)
- outstream.write(block)
- while len(block)==blocksize:
- block = instream.read(blocksize)
- outstream.write(block)
- except IOError:
- raise IOError, ("%s (%s)" %(self.id, filename))
- try: instream.seek(0)
- except: pass
- if close_in: instream.close()
- if close_out: outstream.close()
-
- def _get_new_ufn(self):
- """ Create a new unique filename, drop the last newline
- The base64 set of characters are listed in rfc1341. Unfortunately
- it includes the / character, and I must deal with that in UNIX systems.
- """
- return string.translate(binascii.b2a_base64(md5.new(self.absolute_url(1)).digest()),
- fixslash,'\r\n')
-
- def physicalpath(self, filename=''):
- """ Generate the full filename, including directories from
- _repos and self._filename
- """
- path = _repos
- if type(filename)==types.ListType:
- for item in filename:
- path = join(path,item)
- elif filename != '':
- path = join(path,filename)
- return path
-
-
- ################################
- ## Special management methods #
- ################################
-
- def manage_afterAdd(self, item, container, new_fn=None):
- """ This method is called, whenever _setObject in ObjectManager gets
- called. This is the case after a normal add and if the object is a
- result of cut-paste- or rename-operation.
- """
- new_fn = new_fn or self._get_new_ufn()
- if self._filename != '':
- old_fn = self.physicalpath(self._filename)
- if isfile(old_fn):
- self._copy(old_fn, self.physicalpath(new_fn))
- else:
- if isfile(old_fn+'.undo'):
- self._copy(old_fn+'.undo', self.physicalpath(new_fn))
- self._filename = new_fn
- self._loadpickles()
- return RDFGrabber.inheritedAttribute ("manage_afterAdd") \
- (self, item, container)
-
- def manage_beforeDelete(self, item, container):
- """ This method is called, when the object is deleted. To support
- undo-functionality and because this happens too, when the object
- is moved (cut-paste) or renamed, the external file is not deleted.
- It is just renamed to filename.undo and remains in the
- repository, until it is deleted manually.
- """
- fn = self.physicalpath(self._filename)
- try:
- os.unlink(fn+'.undo')
- except OSError:
- pass
- try:
- os.rename(fn, fn+'.undo')
- except OSError:
- pass
- return RDFGrabber.inheritedAttribute ("manage_beforeDelete") \
- (self, item, container)
-
- def manage_undo_transactions(self, transaction_info, REQUEST=None):
- """ This method is called, when the user has chosen an Undo-action.
- To support undo-functionality the external file is just renamed back from
- filename.undo to filename.
- """
- fn = self.physicalpath(self._filename)
- try:
- os.rename(fn+'.undo', fn)
- self._loadpickles()
- except OSError:
- pass
- return RDFGrabber.inheritedAttribute ("manage_undo_transactions") \
- (self, transaction_info, REQUEST)
-
-Globals.default__class_init__(RDFGrabber)
-
-def manage_addRDFGrabber(self, id, title, rdfurls, http_proxy, REQUEST=None):
- """Create an object and install it in its parent Folder.
- The argument 'self' will be bound to the parent Folder.
- """
- grabber = RDFGrabber(id, title, rdfurls, http_proxy )
- self._setObject(id, grabber)
- if REQUEST is not None:
- return self.manage_main(self, REQUEST)
-
-manage_addRDFGrabberForm = Globals.DTMLFile('add_grabber', globals())
Deleted: zope-rdfgrabber/trunk/README.txt
===================================================================
--- zope-rdfgrabber/trunk/README.txt 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/README.txt 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,105 +0,0 @@
-README for RDFGrabber
-
- RDFGrabber is a product to search content from other web sites
- provided they make it available in
- "RDF":http://www.w3.org/RDF/ format.
-
- The benefit of doing it this way is that the data you get is not
- encumbered with HTML, giving you more flexibility when applying your
- own look and feel.
-
-How to use it
-
- First you install RDFGrabber.tgz in the Products folder and restart
- Zope. You will now be able to create objects of the type "RDF
- Grabber". The form will ask you four questions: the id, title, URLs
- of the RDF File/Files and an optional proxy.
- You enter the URL that will return a correct RDF format.
- If your RDF file is password protected you can specify authentication
- parameters like this:
- http://user:password@host.domain.com/file.rdf
-
- I have created some test files on Zope.org:
- Prefix all names with http://www.zope.org/Members/EIONET/RDFGrabber/
-
- rdfexample1.rdf -- Simple example
-
- rdfexample2.rdf -- The second example.
-
- rdfexample2.rdf -- The third example.
-
- When you have created the object, you must update or synchronize the
- object with the content on the remote webserver. Click Update to
- perform it. Most common mistake is bad encoding of the file in which
- case you get a syntax error.
-
- There is also an optional property for a proxy-server. You enter the
- URL of the proxy as in http://proxy.mycompany.com:8080.
-
- Let's say you have created a RDF-file called articledb. Then insert this
- in your dtml-document to query the RDF:
-<pre>
-<dtml-with articledb>
-<dtml-in "query(predicate='http://purl.org/metadata/dublin_core#Title')">
- <dtml-with sequence-item>
- <dtml-var subject>
- <dtml-var predicate>
- <dtml-var object>
- </dtml-with>
-</dtml-in>
-</dtml-with>
-</pre>
-
- If you want your RDF object to import data on a regular basis, you
- can write a program which updates the channel by doing a GET on the update
- method as in lynx -source http://www.mysite.com/slashdot/update >/dev/null
-
-How it works
-
- An RDF-file consists of an triple (Subject, Predicate, Object).
- They are implemented as Python tuples.
-
- A Python dictionary is also known as an associative array. It is kind
- of like a sack, where you can put all your goodies tagged with a
- keyword you can use to get them back.
-
- RDFGrabber parses the RDF-file, and for each tag inside the four
- main parts, it stores them under a keyword. Since there is only a few
- mandatory tags, you must typically first check if the dictionary
- contains the item before you can use it.
-
- RDFGrabber supports the core RDF, and modules, for example:
- syndication and Dublin Core. How it supports them is very simple. It
- simply maps the namespaces to easily usable keywords. The Dublin Core
- has one tag for dates, but RDFGrabber doesnt try to understand the
- date. It just treats it as a string.
-
-Querying
-
- The RDF-file can be queried on its Predicates. The query-tab shows an
- example of this as a combo-box presenting the parsed predicates.
- The user has also the possibility to fill in an arbitary expression-value.
- the API
-
-Persistence
-
- The RDF-source is not stored in the ZODB because the object is likely to
- be updated often, which means that the ZODB would grow a lot.
- Therefore it is instead represented as volatile and dumped to the filesystem
- using the Python "pickle" command.
-
-Restrictions & peculiarities
-
- Encoding -- The encoding from the xml processing instruction is saved and
- added to the rdf dictionary.
-
- HTML -- HTML (or XHTML) is not allowed inside an RDF file. This may
- come as surprise to some, but this would circumvent what RDF is
- trying to achieve.
-
- Entities -- All known and unknown entities are supported.
-
-Acknowledgements
-
- The parser is inspired from the
- <a href ="http://sourceforge.net/projects/redfoot">redfoot project</a>.
Deleted: zope-rdfgrabber/trunk/__init__.py
===================================================================
--- zope-rdfgrabber/trunk/__init__.py 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/__init__.py 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,32 +0,0 @@
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-#
-# The Original Code is RDFGrabber version 1.0.
-#
-# The Initial Developer of the Original Code is European Environment
-# Agency (EEA). Portions created by EEA are
-# Copyright (C) European Environment Agency. All
-# Rights Reserved.
-#
-# Contributor(s):
-# Soren Roug, EEA
-# Tomas Hjelmberg, CMG
-#
-
-import RDFGrabber
-
-def initialize(context):
- """Initialize the RDFGrabber product.
- """
- context.registerClass(
- RDFGrabber.RDFGrabber,
- constructors = (RDFGrabber.manage_addRDFGrabberForm,
- RDFGrabber.manage_addRDFGrabber),
- icon = 'rdf.gif')
Deleted: zope-rdfgrabber/trunk/add_grabber.dtml
===================================================================
--- zope-rdfgrabber/trunk/add_grabber.dtml 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/add_grabber.dtml 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,42 +0,0 @@
-<dtml-var manage_page_header>
-<dtml-var "manage_form_title(this(), _,
- form_title='Add RDF Grabber')">
- <form action="manage_addRDFGrabber" method="POST">
- <table cellspacing="2">
-
- <tr>
- <th align="LEFT" valign="TOP">Id</th>
- <td align="LEFT" valign="TOP">
- <input type="TEXT" name="id" size="25">
- </td>
- </tr>
-
- <tr>
- <th align="LEFT" valign="TOP"><em>Title</em></th>
- <td align="LEFT" valign="TOP">
- <input type="TEXT" name="title" size="50">
- </td>
- </tr>
-
- <tr>
- <th align="LEFT" valign="TOP">URLs of RDF files</th>
- <td align="LEFT" valign="TOP">
- <textarea name="rdfurls:lines" rows="5" cols="50"></textarea>
- </td>
- </tr>
-
- <tr>
- <th align="LEFT" valign="TOP">Optional Proxy Server</th>
- <td align="LEFT" valign="TOP">
- <input type="TEXT" name="http_proxy" size="50">
- </td>
- </tr>
-
- <tr>
- <td></td>
- <td><br><input type="SUBMIT" value="Add"></td>
- </tr>
-
- </table>
- </form>
-<dtml-var manage_page_footer>
Deleted: zope-rdfgrabber/trunk/const.py
===================================================================
--- zope-rdfgrabber/trunk/const.py 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/const.py 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,48 +0,0 @@
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-#
-# The Original Code is RDFGrabber version 1.0.
-#
-# The Initial Developer of the Original Code is European Environment
-# Agency (EEA). Portions created by EEA are
-# Copyright (C) European Environment Agency. All
-# Rights Reserved.
-#
-# Contributor(s):
-# Soren Roug, EEA
-#
-
-from objects import resource
-
-# Useful RDF constants
-
-# SYNTAX
-RDFNS = "http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-
-TYPE = resource(RDFNS + "type")
-PROPERTY = resource(RDFNS + "Property")
-STATEMENT = resource(RDFNS + "Statement")
-SUBJECT = resource(RDFNS + "subject")
-PREDICATE = resource(RDFNS + "predicate")
-OBJECT = resource(RDFNS + "object")
-
-# SCHEMA
-RDFSNS = "http://www.w3.org/2000/01/rdf-schema#"
-
-CLASS = resource(RDFSNS + "Class")
-RESOURCE = resource(RDFSNS + "Resource")
-SUBCLASSOF = resource(RDFSNS + "subClassOf")
-LABEL = resource(RDFSNS + "label")
-COMMENT = resource(RDFSNS + "comment")
-RANGE = resource(RDFSNS + "range")
-DOMAIN = resource(RDFSNS + "domain")
-LITERAL = resource(RDFSNS + "Literal")
-CONTAINER = resource(RDFSNS + "Container")
-
Modified: zope-rdfgrabber/trunk/debian/changelog
===================================================================
--- zope-rdfgrabber/trunk/debian/changelog 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/debian/changelog 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,3 +1,11 @@
+zope-rdfgrabber (0.4-8) unstable; urgency=low
+
+ * bump standards-version to 3.7.2
+ * bump debhelper compat and depends to 5
+ * move debhelper to Build-Depends
+
+ -- Jonas Meurer <mejo at debian.org> Wed, 1 Nov 2006 22:17:57 +0100
+
zope-rdfgrabber (0.4-7) unstable; urgency=low
* fix dzproduct file (closes: #344319)
Modified: zope-rdfgrabber/trunk/debian/compat
===================================================================
--- zope-rdfgrabber/trunk/debian/compat 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/debian/compat 2006-11-01 21:20:19 UTC (rev 400)
@@ -1 +1 @@
-4
+5
Modified: zope-rdfgrabber/trunk/debian/control
===================================================================
--- zope-rdfgrabber/trunk/debian/control 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/debian/control 2006-11-01 21:20:19 UTC (rev 400)
@@ -3,8 +3,9 @@
Priority: extra
Maintainer: Debian Zope team <pkg-zope-developers at lists.alioth.debian.org>
Uploaders: Jonas Meurer <mejo at debian.org>
-Standards-Version: 3.6.2
-Build-Depends-Indep: debhelper (>= 4.0.0), zope-debhelper
+Standards-Version: 3.7.2
+Build-Depends: debhelper (>= 5.0.0)
+Build-Depends-Indep: zope-debhelper
Package: zope-rdfgrabber
Architecture: all
Deleted: zope-rdfgrabber/trunk/edit_prop.dtml
===================================================================
--- zope-rdfgrabber/trunk/edit_prop.dtml 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/edit_prop.dtml 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,61 +0,0 @@
-<dtml-var manage_page_header>
-<dtml-var manage_tabs>
-
- <h2>Edit RDF Grabber</h2>
-
- <form action="manage_edit" method="POST">
- <table cellspacing="2">
-
- <tr>
- <th align="LEFT" valign="TOP">Id</th>
- <td align="LEFT" valign="TOP">
- &dtml-id;
- </td>
- </tr>
-
- <tr>
- <th align="LEFT" valign="TOP">Filename</th>
- <td align="LEFT" valign="TOP">
- &dtml-filename;
- </td>
- </tr>
-
- <tr>
- <th align="LEFT" valign="TOP"><em>Title</em></th>
- <td align="LEFT" valign="TOP">
- <input type="TEXT" name="title" size="50"
- value="&dtml-title;">
- </td>
- </tr>
-
- <tr>
- <th align="LEFT" valign="TOP">RDFGrabber URLs</th>
- <td align="LEFT" valign="TOP">
- <textarea name="rdfurls:lines" cols="50"
- rows="5"><dtml-var "_.string.join(rdfurls,'\n')" html_quote></textarea>
- </td>
- </tr>
-
- <tr>
- <th align="LEFT" valign="TOP">Proxy Server</th>
- <td align="LEFT" valign="TOP">
- <input type="TEXT" name="http_proxy" size="50"
- value="<dtml-var http_proxy html_quote>">
- </td>
- </tr>
-
- <tr>
- <th align="LEFT" valign="TOP">Last Update</th>
- <td align="LEFT" valign="TOP">
- <dtml-var lastupdated>
- </td>
- </tr>
-
- <tr>
- <td></td>
- <td><br><input type="SUBMIT" value="Change"></td>
- </tr>
-
- </table>
- </form>
-<dtml-var manage_page_footer>
Deleted: zope-rdfgrabber/trunk/htmlview.dtml
===================================================================
--- zope-rdfgrabber/trunk/htmlview.dtml 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/htmlview.dtml 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,64 +0,0 @@
-<dtml-call "RESPONSE.setHeader('content-type', 'text/html; charset=UTF-8')">
-<dtml-var manage_page_header>
-<dtml-with "_(management_view='Triples')">
-<dtml-var manage_tabs>
-</dtml-with>
-<h2>Parsed Content</h2>
-
-<table bgcolor="#f0f0f0" border=1 width="100%">
- <caption>Properties</caption>
- <tr>
- <th>Id</th>
- <td>&dtml-id;</td>
- </tr>
- <tr>
- <th>Title</th>
- <td>&dtml-title;</td>
- </tr>
- <tr>
- <th>URLs</th>
- <td><dtml-var "_.string.join(rdfurls,'\n')" html_quote newline_to_br></td>
- </tr>
- <tr>
- <th>Last edited</th>
- <td><dtml-var bobobase_modification_time></td>
- </tr>
- <tr>
- <th>Last updated</th>
- <td><dtml-var lastupdated></td>
- </tr>
-</table>
-
-<table bgcolor="#f0f0f0" border=1 width="100%">
- <caption>Triples of the Data Model</caption>
- <tr>
- <th>Number</th>
- <th>Subject</th>
- <th>Predicate</th>
- <th>Object</th>
- </tr>
- <dtml-in triples>
- <dtml-with sequence-item>
- <tr>
- <td><dtml-var sequence-index></td>
- <td><a href="query_html?subject=<dtml-var subject url_quote>"><dtml-var subject></a></td>
- <td><a href="query_html?predicate=<dtml-var predicate url_quote>"><dtml-var predicate></a></td>
- <dtml-try>
- <dtml-if "object().is_anonymous()">
- <td><a href="query_html?subject=<dtml-var object
- url_quote>"><dtml-var object></a></td>
- <dtml-else>
- <td><dtml-var object></td>
- </dtml-if>
- <dtml-except>
- Problemer med <dtml-var object>
- </dtml-try>
- </tr>
- </dtml-with>
- <dtml-else>
- <tr><th>
- Nothing imported
- </th></tr>
- </dtml-in>
-</table>
-<dtml-var manage_page_footer>
Deleted: zope-rdfgrabber/trunk/objects.py
===================================================================
--- zope-rdfgrabber/trunk/objects.py 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/objects.py 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,80 +0,0 @@
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-#
-# The Original Code is RDFGrabber version 1.0.
-#
-# The Initial Developer of the Original Code is European Environment
-# Agency (EEA). Portions created by EEA are
-# Copyright (C) European Environment Agency. All
-# Rights Reserved.
-#
-# Contributor(s):
-# Soren Roug, EEA
-#
-
-import string
-
-resources_dict = {}
-literal_dict = {}
-
-def resource(uri, anonymous=None):
- if uri==None:
- r = None
- elif resources_dict.has_key(uri):
- r = resources_dict[uri]
- else:
- r = resources_dict[uri] = Resource(uri, anonymous)
- return r
-
-# fixme: What should happen if two different languages happen
-# to use the same word?
-def literal(value,lang):
- if value==None:
- r = None
- elif literal_dict.has_key((value,lang)):
- r = literal_dict[(value,lang)]
- else:
- r = literal_dict[(value,lang)] = Literal(value,lang)
- return r
-
-
-class Resource:
- def __init__(self, uri, anonymous):
- self.uri = uri
- self.anonymous = anonymous
-
- def __str__(self):
- return self.uri
-
- def is_literal(self):
- return None
-
- def is_resource(self):
- return 1
-
- def is_anonymous(self):
- return self.anonymous
-
-class Literal:
- def __init__(self, value,lang):
- self.value = value
- self.lang = lang
-
- def __str__(self):
- return self.value
-
- def is_literal(self):
- return 1
-
- def is_resource(self):
- return None
-
- def is_anonymous(self):
- return None
Deleted: zope-rdfgrabber/trunk/parsed.dtml
===================================================================
--- zope-rdfgrabber/trunk/parsed.dtml 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/parsed.dtml 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,28 +0,0 @@
-<dtml-var manage_page_header>
-<dtml-var manage_tabs>
- <h2>Query</h2>
-<form action="query_html" method="POST">
- <table cellspacing="2">
- <tr>
- <th align="LEFT" valign="TOP"><em>Predicate</em></th>
- <td align="LEFT" valign="TOP">
- <select name="predicate">
- <dtml-in "predicates().keys()">
- <option><dtml-var sequence-item html_quote></option>
- </dtml-in>
- </select>
- </td>
- </tr>
- <tr>
- <th align="LEFT" valign="TOP"><em>Expression</em></th>
- <td align="LEFT" valign="TOP">
- <input type="TEXT" name="question" size="50" value="">
- </td>
- </tr>
- <tr>
- <td></td>
- <td><br><input type="SUBMIT"></td>
- </tr>
- </table>
-</form>
-<dtml-var manage_page_footer>
Deleted: zope-rdfgrabber/trunk/rdf.gif
===================================================================
(Binary files differ)
Deleted: zope-rdfgrabber/trunk/rdfparser.py
===================================================================
--- zope-rdfgrabber/trunk/rdfparser.py 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/rdfparser.py 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,335 +0,0 @@
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-#
-# The Original Code is RDFGrabber version 1.0.
-#
-# The Initial Developer of the Original Code is European Environment
-# Agency (EEA). Portions created by EEA are
-# Copyright (C) European Environment Agency. All
-# Rights Reserved.
-#
-# Contributor(s):
-# Soren Roug, EEA
-#
-import operator, string, time
-try:
- import urllib2 # Support for authenticated proxy
- ulib2 = 1
-except:
- import urllib
- ulib2 = 0
-import xmllib
-import sys
-from types import *
-from objects import resource, literal
-from const import *
-from string import join, split
-
-ns_separator = " "
-
-ABOUT_ATTRIBUTE = RDFNS + ns_separator + "about"
-ID_ATTRIBUTE = RDFNS + ns_separator + "ID"
-RESOURCE_ATTRIBUTE = RDFNS + ns_separator + "resource"
-PARSETYPE_ATTRIBUTE = RDFNS + ns_separator + "parseType"
-
-EXPECT_RESOURCE = 0
-EXPECT_PROPERTY = 1
-
-class Context:
- def __init__(self,subject,lang,state):
- self.subject = subject
- self.lang = lang
- self.state = state
-
-class RDFParser(xmllib.XMLParser):
- """Parse an RDF file"""
-
- def __init__(self,adder,http_proxy=None):
- self.adder=adder
- if http_proxy:
- self._proxies = { 'http': http_proxy }
- else:
- self._proxies = {}
- self.state = None
- self.encoding = 'UTF-8'
- self.context = []
- self.subject = None
- self.predicate = []
- self.object=None
- self.li_count = 0
- self.anon_count = 0
- self.__data = []
- self.lang = ''
- self.elements = {
- # RDF
- RDFNS + ns_separator + 'RDF':
- (self.start_rdf,self.end_rdf),
- RDFNS + ns_separator + 'Description':
- (self.start_description,self.end_description),
- RDFNS + ns_separator + 'Seq':
- (self.start_container,self.end_container),
- RDFNS + ns_separator + 'Bag':
- (self.start_container,self.end_container),
- RDFNS + ns_separator + 'Alt':
- (self.start_container,self.end_container),
- RDFNS + ns_separator + 'li':
- (self.start_list,self.end_list),
- }
- xmllib.XMLParser.__init__(self)
-
- def push(self):
- self.context.append(Context(self.subject, self.lang, self.state))
-
- def pop(self):
- self.context.pop()
- self.lang = self.context[-1].lang
- self.state = self.context[-1].state
- self.subject = self.context[-1].subject
-
- def dupcontext(self):
- self.context.append(self.context[-1])
-
- def generate_uri(self):
- "Generate a unique id for an anonymous resource"
- self.anon_count = self.anon_count + 1
- return resource("genid:" + str(self.anon_count),anonymous=1)
-
- def xmllang_attr(self,atts):
- "Check attributes for xml:lang and delete it"
- if atts.has_key("xml:lang"):
- self.lang = atts["xml:lang"]
- del atts["xml:lang"]
-
- def about_id_attr(self,atts):
- if atts.has_key(ABOUT_ATTRIBUTE):
- if atts[ABOUT_ATTRIBUTE][0] == "#":
- self.subject = resource(self.baseurl + atts[ABOUT_ATTRIBUTE])
- else:
- self.subject = resource(atts[ABOUT_ATTRIBUTE])
- self.push()
- del atts[ABOUT_ATTRIBUTE]
- elif atts.has_key(ID_ATTRIBUTE):
- self.subject = resource(self.baseurl + "#" + atts[ID_ATTRIBUTE])
- self.push()
- del atts[ID_ATTRIBUTE]
- else:
- self.subject = self.generate_uri()
- self.push()
-
- def handle_xml(self,encoding,standalone):
- if(encoding):
- self.encoding = encoding
-
- def unknown_starttag(self, tag, atts):
- if string.find(tag," ") == -1:
- if self.baseurl[-1] != '/' and self.baseurl[-1] != '#':
- tag = self.baseurl + '#' + ns_separator + tag
- else:
- tag = self.baseurl + ns_separator + tag
- if self.state == EXPECT_RESOURCE:
- self.start_resource(tag, atts)
- else:
- self.start_property(tag,atts)
-
- def unknown_endtag(self, tag):
- if string.find(tag," ") == -1:
- tag = self.baseurl + ns_separator + tag
- if self.state == EXPECT_PROPERTY:
- self.end_resource(tag)
- else:
- self.end_property(tag)
-
- def start_property(self, tag, atts):
- self.__data = []
- self.object = None
- self.state = EXPECT_RESOURCE
- self.xmllang_attr(atts)
- self.push()
- tag = join(split(tag, ns_separator), "")
- if atts.has_key(PARSETYPE_ATTRIBUTE):
- if atts[PARSETYPE_ATTRIBUTE] == "Resource":
- del atts[PARSETYPE_ATTRIBUTE]
- newsub = self.generate_uri()
- self.adder(self.subject,tag,newsub)
- self.pop()
- self.subject = newsub
- self.state = EXPECT_PROPERTY
- self.push()
- else: # Only Literal is allowed
- del atts[PARSETYPE_ATTRIBUTE]
- self.setliteral()
- elif atts.has_key(RESOURCE_ATTRIBUTE):
- if atts[RESOURCE_ATTRIBUTE][0] == "#":
- self.object = resource(self.baseurl + atts[RESOURCE_ATTRIBUTE])
- else:
- self.object = resource(atts[RESOURCE_ATTRIBUTE])
- del atts[RESOURCE_ATTRIBUTE]
- for att in atts.keys():
- if att == ID_ATTRIBUTE: # Just in case both about and ID
- pass
- else:
- new_att = resource(join(split(att, ns_separator), ""))
- self.adder(self.object, new_att, literal(atts[att],self.lang))
-
- def end_property(self, tag):
- if self.object == None:
- self.object = literal(string.join(self.__data,""),self.lang)
- self.pop()
- type = resource(join(split(tag, ns_separator), ""))
- self.adder(self.subject, type, self.object)
- self.object = None
-
- def start_resource(self, tag, atts):
- self.state = EXPECT_PROPERTY
- self.__data = []
- self.object = None
- self.anon_object=0
- tag = join(split(tag, ns_separator), "")
- self.xmllang_attr(atts)
- self.about_id_attr(atts)
- self.adder(self.context[-1].subject, TYPE, resource(tag))
-
- for att in atts.keys():
- if att == ID_ATTRIBUTE: # Just in case both about and ID
- pass
- else:
- new_att = resource(join(split(att, ns_separator), ""))
- self.adder(self.context[-1].subject, new_att, literal(atts[att],self.lang))
-
- def end_resource(self,tag):
- self.object = self.subject
- self.pop()
-
- def ignore_tag(self,atts=None):
- pass
-
- def handle_data(self, text):
- self.__data.append(text)
-
- def handle_cdata(self, text):
- self.__data.append(text)
-
- def handle_charref(self,ref):
- self.handle_data('&#' + ref + ';')
-
- def unknown_entityref(self,ref):
- self.handle_data('&' + ref + ';')
-
- def syntax_error(self,message):
- pass
-
- def start_rdf(self, tag, atts):
- "Start of rdf info"
- self.xmllang_attr(atts)
- self.state = EXPECT_RESOURCE
- self.subject = None
- self.push()
-
- def end_rdf(self,tag):
- pass
-
- def start_container(self, tag, atts):
- self.xmllang_attr(atts)
- self.about_id_attr(atts)
- self.li_count = 0
-
- def end_container(self,tag):
- tag = join(split(tag, ns_separator), "")
- self.adder(self.subject,TYPE,resource(tag))
- self.pop()
-
- def start_description(self, tag, atts):
- """
- rdf:Descriptions are like classes, but don't generate a type
- statement.
- """
- self.__data = []
- self.object = None
- self.state = EXPECT_PROPERTY
- self.xmllang_attr(atts)
- self.about_id_attr(atts)
-
- for att in atts.keys():
- if att == ABOUT_ATTRIBUTE or att == ID_ATTRIBUTE:
- pass
- else:
- new_att = resource(join(split(att, ns_separator), ""))
- self.adder(self.context[-1].subject, new_att, literal(atts[att],self.lang))
-
- def end_description(self,tag):
- self.object = self.subject
- self.pop()
-
- def start_list(self, tag, atts):
- self.__data = []
- self.object = None
- tag = join(split(tag, ns_separator), "")
- self.li_count = self.li_count + 1
- self.predicate.append(resource(RDFNS + '_' + str(self.li_count)))
-
- if atts.has_key(RESOURCE_ATTRIBUTE):
- if atts[RESOURCE_ATTRIBUTE][0] == "#":
- self.object = resource(self.baseurl + atts[RESOURCE_ATTRIBUTE])
- else:
- self.object = resource(atts[RESOURCE_ATTRIBUTE])
- del atts[RESOURCE_ATTRIBUTE]
- for att in atts.keys():
- if att == ID_ATTRIBUTE: # Just in case both about and ID
- pass
- else:
- new_att = resource(join(split(att, ns_separator), ""))
- self.adder(self.predicate[-1], new_att, literal(atts[att],self.lang))
-
- def end_list(self, tag):
- if self.object == None:
- self.object = literal(string.join(self.__data,""),self.lang)
- self.adder(self.subject, self.predicate.pop(), self.object)
- self.object = self.subject
-
- def handle_starttag(self, tag, method, atts):
- method(tag,atts)
-
- def handle_endtag(self, tag, method):
- method(tag)
-
- def parse_url(self, url):
- """
- Grab the file from the webserver and feed it to the parser
- """
- self.encoding = 'UTF-8'
- self.state = None
- self.context=[]
- self.subject = None
- self.predicate=[]
- self.object=None
- self.li_count = 0
- self.__data=[]
- self.lang = ''
- self.baseurl = url
- if ulib2 == 1:
- proxy_support = urllib2.ProxyHandler(self._proxies)
- opener = urllib2.build_opener(proxy_support,
- urllib2.HTTPHandler,urllib2.FileHandler)
-
- urllib2.install_opener(opener)
- f = urllib2.urlopen(url)
- else:
- try:
- u = urllib.URLopener(proxies=self._proxies)
- except IOError, e:
- raise IOError, "Unsupported protocol"
- else:
- u.addheader("User-agent", "RDFGrabber (helpdesk at eionet.eu.int)")
- f = u.open(url)
- if not f:
- raise IOError, "Failure in open %s" % url
- self.rdfsource = f.read()
- self.feed(self.rdfsource)
- f.close()
Deleted: zope-rdfgrabber/trunk/results.dtml
===================================================================
--- zope-rdfgrabber/trunk/results.dtml 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/results.dtml 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,108 +0,0 @@
-<dtml-call "RESPONSE.setHeader('content-type', 'text/html; charset=UTF-8')">
-<dtml-var manage_page_header>
-<dtml-with "_(management_view='Query')">
-<dtml-var manage_tabs>
-</dtml-with>
-<dtml-if "REQUEST.has_key('subject')">
- <h2>Subject: <dtml-var subject html_quote></h2>
-
- <table bgcolor="#f0f0f0" border=1 width="100%">
- <tr><th>Predicate</th><th>Object</th></tr>
- <dtml-in "query(subject=subject)">
- <dtml-with sequence-item>
- <tr>
- <td><a href="query_html?predicate=<dtml-var predicate url_quote>"><dtml-var predicate></a></td>
- <dtml-if "object().is_anonymous()">
- <td><a href="query_html?subject=<dtml-var object
- url_quote>"><dtml-var object></a><br>
- <i>Dumbdown value(s):</i>
- <dtml-var "_.string.join(dumbdown(object()),'<br>')">
- <dtml-else>
- <td><a href="query_html?object=<dtml-var object
- url_quote>"><dtml-var object></a>
- </dtml-if>
- <dtml-if "object().is_resource()">
- <a href="<dtml-var object>">[Goto]</a>
- </dtml-if>
- </td>
- </tr>
- </dtml-with>
- </dtml-in>
- </table>
- <a href="query_html?object=<dtml-var subject html_quote>">Are
- there any triples where the object is pointing to this subject?</a>
-<dtml-elif "REQUEST.has_key('predicate')">
-<h2>Predicate <dtml-var predicate html_quote> contains
- '<dtml-var question missing=Anything html_quote>'</h2>
- <table bgcolor="#f0f0f0" border=1 width="100%">
- <tr><th>Subject</th><th>Object</th></tr>
- <dtml-if "REQUEST.has_key('question')">
- <dtml-call "REQUEST.set('question',_.string.lower(question))">
- <dtml-else>
- <dtml-call "REQUEST.set('question',_.None)">
- </dtml-if>
-
- <dtml-in "query(predicate=predicate,object=question)">
- <dtml-with sequence-item>
- <tr>
- <td><a href="query_html?subject=<dtml-var subject url_quote>"><dtml-var subject></a></td>
- <td>
- <dtml-if "object().is_anonymous()">
- <a href="query_html?subject=<dtml-var object
- url_quote>"><dtml-var object></a><br>
- <i>Dumbdown value(s):</i>
- <dtml-var "_.string.join(dumbdown(object()),'<br>')">
- <dtml-else>
- <a href="query_html?object=<dtml-var object
- url_quote>"><dtml-var object></a>
- </dtml-if>
- <dtml-if "object().is_resource()">
- <a href="<dtml-var object>">[Goto]</a>
- </dtml-if>
- </td>
- </tr>
- </dtml-with>
- </dtml-in>
- </table>
-<dtml-elif "REQUEST.has_key('object')">
- <h2>Object: <dtml-var object html_quote></h2>
-
- <table bgcolor="#f0f0f0" border=1 width="100%">
- <tr><th>Subject</th><th>Predicate</th></tr>
- <dtml-in "query(object=object)">
- <dtml-with sequence-item>
- <tr>
- <td><a href="query_html?subject=<dtml-var subject url_quote>"><dtml-var subject></a></td>
- <td><a href="query_html?predicate=<dtml-var predicate url_quote>"><dtml-var predicate></a></td>
- </tr>
- </dtml-with>
- </dtml-in>
- </table>
-<dtml-else>
-<h2>Query</h2>
-<form action="query_html" method="POST">
- <table cellspacing="2">
- <tr>
- <th align="LEFT" valign="TOP"><em>Predicate</em></th>
- <td align="LEFT" valign="TOP">
- <select name="predicate">
- <dtml-in "predicates().keys()">
- <option><dtml-var "label_of(_['sequence-item'])" html_quote></option>
- </dtml-in>
- </select>
- </td>
- </tr>
- <tr>
- <th align="LEFT" valign="TOP"><em>Expression</em></th>
- <td align="LEFT" valign="TOP">
- <input type="TEXT" name="question" size="50" value="">
- </td>
- </tr>
- <tr>
- <td></td>
- <td><br><input type="submit"> <input type="reset"></td>
- </tr>
- </table>
-</form>
-</dtml-if>
-<dtml-var manage_page_footer>
Deleted: zope-rdfgrabber/trunk/source.dtml
===================================================================
--- zope-rdfgrabber/trunk/source.dtml 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/source.dtml 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,29 +0,0 @@
-<dtml-call "RESPONSE.setHeader('content-type', 'text/html; charset=UTF-8')">
-<dtml-var manage_page_header>
-<dtml-var manage_tabs>
- <h2>Source</h2>
-<table>
-<tr>
- <th>Id:</th>
- <td>&dtml-id;</td>
-</tr>
-<tr>
- <th>Title:</th>
- <td>&dtml-title;</td>
-</tr>
-<tr>
- <th>URLs:</th>
- <td><dtml-var "_.string.join(rdfurls,'\n')" html_quote newline_to_br></td>
-</tr>
-</table>
-<dtml-in rdfurls>
-<h3><dtml-var sequence-item html_quote></h3>
-<pre>
-<dtml-var "rdfsources(_['sequence-item'])" html_quote>
-</pre>
-<dtml-else>
-<p>
-You either haven't imported anything, or the last import went wrong.
-</p>
-</dtml-in>
-<dtml-var manage_page_footer>
Deleted: zope-rdfgrabber/trunk/testparser.py
===================================================================
--- zope-rdfgrabber/trunk/testparser.py 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/testparser.py 2006-11-01 21:20:19 UTC (rev 400)
@@ -1,123 +0,0 @@
-# The contents of this file are subject to the Mozilla Public
-# License Version 1.1 (the "License"); you may not use this file
-# except in compliance with the License. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-# Software distributed under the License is distributed on an "AS
-# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
-# implied. See the License for the specific language governing
-# rights and limitations under the License.
-#
-# The Original Code is RDFGrabber version 1.0.
-#
-# The Initial Developer of the Original Code is European Environment
-# Agency (EEA). Portions created by EEA are
-# Copyright (C) European Environment Agency. All
-# Rights Reserved.
-#
-# Contributor(s):
-# Soren Roug, EEA
-#
-
-from sys import argv
-import rdfparser
-from objects import *
-
-# Constants for the tupples in ICanAdd()
-SUBJECT=0
-PREDICATE=1
-OBJECT=2
-
-class SPO:
- def __init__(self, subject,predicate,object):
- self._subject = subject
- self._predicate = predicate
- self._object = object
-
- def strsubject(self):
- return str(self._subject)
- def strpredicate(self):
- return str(self._predicate)
- def strobject(self):
- return str(self._object)
-
- def subject(self):
- return self._subject
- def predicate(self):
- return self._predicate
- def object(self):
- return self._object
-
-
-class RDFGrabber:
- def __init__(self):
- self.triples = []
- self.subjects = {}
- self.predicates = {}
- self.objects = {}
-
- def ICanAdd(self,subject, predicate, object):
- # Assume spo is shared in all dictionaries
- spo = SPO(subject, predicate, object)
-
- if object.is_literal():
- print '<%s> <%s> "%s (%s)" .' % (subject, predicate, object,object.lang)
- else:
- print "<%s> <%s> <%s> ." % (subject, predicate, object)
-
- self.triples.append(spo)
-
- x = str(subject)
- if not self.subjects.has_key(x):
- self.subjects[x] = []
- self.subjects[x].append(spo)
-
- x = str(predicate)
- if not self.predicates.has_key(x):
- self.predicates[x] = []
- self.predicates[x].append(spo)
-
- x = str(object)
- if not self.objects.has_key(x):
- self.objects[x] = []
- self.objects[x].append(spo)
-
- def lookup_predicate(self,predicate):
- if not self.predicates.has_key(predicate):
- return []
- return self.predicates[predicate]
-
- def dumbdown(self,spo,list=[]):
- for i in spo:
- if i[4] == 0:
- if i[1] == "http://www.w3.org/1999/02/22-rdf-syntax-ns#value" \
- or i[1][:44] == "http://www.w3.org/1999/02/22-rdf-syntax-ns#_":
- list.append(i[2])
- else:
- self.dumbdown(self.subjects[i[2]],list)
- return list
-
- def runtest(self,argv):
- p=rdfparser.RDFParser(self.ICanAdd)
- for arg in argv[1:]:
- p.parse_url(arg)
-
-r = RDFGrabber()
-r.runtest(argv)
-
-s = r.lookup_predicate("http://purl.org/metadata/dublin_core#Publisher")
-if s != []:
- print s[0].subject()
-
-#print "TRIPLES"
-#for x in r.triples:
-# print "(%s | %s | %s)" % ( x[SUBJECT], x[PREDICATE], x[OBJECT][0:20] )
-# print "(%s | %s | %s)" % ( x[SUBJECT][0:20], x[PREDICATE][0:20], x[OBJECT][0:20] )
-
-#print "NOW WE FIND THE TITLE IN THE DICTIONARIES"
-#for x in r.predicates['http://purl.org/metadata/dublin_core#Title']:
-# print x[OBJECT]
-#print r.predicates
-#r.list=[]
-#print "DUMB DOWN OF genid:1"
-#print r.dumbdown(r.objects["genid:1"])
Deleted: zope-rdfgrabber/trunk/version.txt
===================================================================
--- zope-rdfgrabber/trunk/version.txt 2006-11-01 21:16:40 UTC (rev 399)
+++ zope-rdfgrabber/trunk/version.txt 2006-11-01 21:20:19 UTC (rev 400)
@@ -1 +0,0 @@
-RDFGrabber-0.4
More information about the pkg-zope-commits
mailing list