Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
python patch for rdflib 3.1
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dave V  
View profile  
 More options Aug 9 2011, 11:52 am
From: Dave V <dave.viegl...@gmail.com>
Date: Tue, 9 Aug 2011 08:52:41 -0700 (PDT)
Local: Tues, Aug 9 2011 11:52 am
Subject: python patch for rdflib 3.1
The following patch applied to svn revision 83 of foresite-python
enables it to work with rdflib 3.1.

Note that the foresite library functionality was not extensively
evaluated, but the tests pass and everything seems to work fine for me
on OS X python 2.7 with rdflib 3.1 and rdfextras installed with
easy_install.

cheers,
  Dave V.

== snip ==

Index: foresite/serializer.py
===================================================================
--- foresite/serializer.py      (revision 83)
+++ foresite/serializer.py      (working copy)
@@ -5,14 +5,15 @@
 from foresite import libraryName, libraryUri, libraryVersion
 from utils import namespaces, OreException, unconnectedAction,
pageSize
 from utils import gen_uuid, build_html_atom_content
-from rdflib import URIRef, BNode, Literal, plugin, syntax, RDF
+from rdflib import URIRef, BNode, Literal, plugin, RDF #syntax, RDF
+from rdflib.serializer import Serializer
 from rdflib.util import uniq
 from lxml import etree
 from lxml.etree import Element, SubElement

-plugin.register('rdfa', syntax.serializers.Serializer,
'foresite.RDFaSerializer', 'RDFaSerializer')
-plugin.register('json', syntax.serializers.Serializer,
'foresite.JsonSerializer', 'JsonSerializer')
-plugin.register('pretty-json', syntax.serializers.Serializer,
'foresite.JsonSerializer', 'PrettyJsonSerializer')
+plugin.register('rdfa', Serializer, 'foresite.RDFaSerializer',
'RDFaSerializer')
+plugin.register('json', Serializer, 'foresite.JsonSerializer',
'JsonSerializer')
+plugin.register('pretty-json', Serializer, 'foresite.JsonSerializer',
'PrettyJsonSerializer')

@@ -329,7 +330,7 @@
             for m in mytypes:
                 if m != namespaces['ore']['Aggregation'] and \
                    m in atypes:
-                    possAlt.append(r.uri)
+                    possAlts.append(r.uri)

         if not altDone and possAlts:
             # XXX more intelligent algorithm here
Index: foresite/parser.py
===================================================================
--- foresite/parser.py  (revision 83)
+++ foresite/parser.py  (working copy)
@@ -3,12 +3,19 @@
 from utils import namespaces, OreException, unconnectedAction,
protocolUriRe
 from lxml import etree
 from xml.dom import minidom
-from rdflib import StringInputSource, URIRef, plugin, syntax
+from rdflib.parser import StringInputSource
+from rdflib import URIRef, plugin, query #, syntax
+from rdflib.parser import Parser

-plugin.register('json', syntax.parsers.Parser, 'foresite.JsonParser',
'JsonParser')
+plugin.register('sparql', query.Processor,
+                       'rdfextras.sparql.processor', 'Processor')
+plugin.register('sparql', query.Result,
+                       'rdfextras.sparql.query', 'SPARQLQueryResult')

+plugin.register('json', Parser, 'foresite.JsonParser', 'JsonParser')

+
 class OREParser(object):
     # Take some data and produce objects/graph
     def __init__(self):
Index: foresite/README.txt
===================================================================
--- foresite/README.txt (revision 83)
+++ foresite/README.txt (working copy)
@@ -23,9 +23,9 @@
 And retrieve properties:

     >>> a._dc.title
-    [rdflib.Literal('My Aggregation', ...
+    [rdflib.term.Literal(u'My Aggregation')]
     >>> a.created
-    [rdflib.Literal('2008-07-10T12:00:00', ...
+    [rdflib.term.Literal(u'2008-07-10T12:00:00')]

 Note that they become lists as any property can be added multiple
times.

@@ -48,7 +48,7 @@
 If no URI assigned, then it will be a blank node:

     >>> me.uri
-    rdflib.BNode(...
+    rdflib.term.BNode(...

 Create an agent with a URI:

@@ -64,13 +64,13 @@

     >>> remdoc = a.get_serialization()
     >>> print remdoc.data
-    <entry ...
+    <atom:entry ...

 Or, equivalently:

     >>> remdoc = rem.get_serialization()
     >>> print remdoc.data
-    <entry ...
+    <atom:entry ...

 Resource Maps can be created by hand:

Index: foresite/RDFaSerializer.py
===================================================================
--- foresite/RDFaSerializer.py  (revision 83)
+++ foresite/RDFaSerializer.py  (working copy)
@@ -1,14 +1,14 @@
 from __future__ import generators

-from rdflib.syntax.serializers import Serializer
+from rdflib.serializer import Serializer

-from rdflib.URIRef import URIRef
-from rdflib.Literal import Literal
-from rdflib.BNode import BNode
+from rdflib.term import URIRef
+from rdflib.term import Literal
+from rdflib.term import BNode

 from rdflib.util import uniq
 from rdflib.exceptions import Error
-from rdflib.syntax.xml_names import split_uri
+#from rdflib.syntax.xml_names import split_uri

 from xml.sax.saxutils import quoteattr, escape


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Sanderson  
View profile  
 More options Aug 9 2011, 12:01 pm
From: Robert Sanderson <azarot...@gmail.com>
Date: Tue, 9 Aug 2011 10:01:35 -0600
Local: Tues, Aug 9 2011 12:01 pm
Subject: Re: [foresite] python patch for rdflib 3.1
Very nice! Many thanks for your work on this!

Would you prefer to just have commit access to the svn rather than
sending patches? :)

Rob


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Dave Vieglais  
View profile  
 More options Aug 9 2011, 12:12 pm
From: Dave Vieglais <dave.viegl...@gmail.com>
Date: Tue, 9 Aug 2011 12:12:30 -0400
Local: Tues, Aug 9 2011 12:12 pm
Subject: Re: [foresite] python patch for rdflib 3.1
Sure, though I don't anticipate many changes will be required beyond this quick fix.

thanks,
  Dave V.

On 2011-08-09, at 12:01 , Robert Sanderson wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »