zeitgeist team mailing list archive
-
zeitgeist team
-
Mailing list archive
-
Message #01601
[Merge] lp:~zeitgeist/zeitgeist/rdflib3 into lp:zeitgeist
Seif Lotfy has proposed merging lp:~zeitgeist/zeitgeist/rdflib3 into lp:zeitgeist.
Requested reviews:
Zeitgeist Framework Team (zeitgeist)
I added some try and excepts to extend to patch given
this way we can work with both rdflib 2 and 3
--
https://code.launchpad.net/~zeitgeist/zeitgeist/rdflib3/+merge/34246
Your team Zeitgeist Framework Team is requested to review the proposed merge of lp:~zeitgeist/zeitgeist/rdflib3 into lp:zeitgeist.
=== modified file 'extra/PythonSerializer.py'
--- extra/PythonSerializer.py 2010-04-26 19:42:07 +0000
+++ extra/PythonSerializer.py 2010-08-31 21:03:44 +0000
@@ -17,9 +17,15 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-from rdflib.syntax.serializers.RecursiveSerializer import RecursiveSerializer
+try:
+ from rdflib.syntax.serializers.RecursiveSerializer import RecursiveSerializer
+except:
+ from rdflib.plugins.serializers.turtle import RecursiveSerializer
from rdflib import RDF, RDFS
-from rdflib.Namespace import Namespace
+try:
+ from rdflib.Namespace import Namespace
+except:
+ from rdflib.namespace import Namespace
NIENS = Namespace("http://www.semanticdesktop.org/ontologies/2007/01/19/nie#")
=== modified file 'extra/rdfxml2py'
--- extra/rdfxml2py 2010-03-05 18:05:55 +0000
+++ extra/rdfxml2py 2010-08-31 21:03:44 +0000
@@ -9,16 +9,25 @@
import rdflib
from rdflib.plugin import register
-from rdflib.syntax import serializer, serializers
+try:
+ from rdflib.syntax import serializer, serializers
+ register('python', serializers.Serializer,
+ 'PythonSerializer', 'PythonSerializer')
+except:
+ from rdflib.plugins import serializers
+ from rdflib import serializer
+ register('python', serializer.Serializer,
+ 'PythonSerializer', 'PythonSerializer')
-register('python', serializers.Serializer,
- 'PythonSerializer', 'PythonSerializer')
def parse(trig_stream):
"""
Return a list of triples representing the ontology
"""
- trig_in = rdflib.FileInputSource(trig_stream)
+ try:
+ trig_in = rdflib.FileInputSource(trig_stream)
+ except:
+ trig_in = rdflib.parser.FileInputSource(trig_stream)
ontology = rdflib.ConjunctiveGraph()
ontology.parse(trig_in)
pycode = ontology.serialize(format="python")
Follow ups