buxon-0.0.5/ 0000700 0001750 0001750 00000000000 11625134417 012203 5 ustar sergio sergio buxon-0.0.5/manpages/ 0000700 0001750 0001750 00000000000 11625134417 013776 5 ustar sergio sergio buxon-0.0.5/src/ 0000700 0001750 0001750 00000000000 11625134417 012772 5 ustar sergio sergio buxon-0.0.5/includes/ 0000700 0001750 0001750 00000000000 11625134417 014011 5 ustar sergio sergio buxon-0.0.5/setup/ 0000700 0001750 0001750 00000000000 11625134417 013343 5 ustar sergio sergio buxon-0.0.5/src/buxon/ 0000700 0001750 0001750 00000000000 11625134417 014125 5 ustar sergio sergio buxon-0.0.5/includes/ui/ 0000700 0001750 0001750 00000000000 11625134417 014426 5 ustar sergio sergio buxon-0.0.5/includes/images/ 0000700 0001750 0001750 00000000000 11625134417 015256 5 ustar sergio sergio buxon-0.0.5/src/buxon/ui/ 0000700 0001750 0001750 00000000000 11625134417 014542 5 ustar sergio sergio buxon-0.0.5/src/buxon/rdf/ 0000700 0001750 0001750 00000000000 11625134417 014700 5 ustar sergio sergio buxon-0.0.5/src/buxon/common/ 0000700 0001750 0001750 00000000000 11625134417 015415 5 ustar sergio sergio buxon-0.0.5/includes/ui/graphical/ 0000700 0001750 0001750 00000000000 11625134417 016360 5 ustar sergio sergio buxon-0.0.5/includes/ui/text/ 0000700 0001750 0001750 00000000000 11625134417 015412 5 ustar sergio sergio buxon-0.0.5/includes/ui/text/usage/ 0000700 0001750 0001750 00000000000 11625134417 016516 5 ustar sergio sergio buxon-0.0.5/README 0000644 0001750 0001750 00000000475 11625127611 013101 0 ustar sergio sergio
Buxon, a sioc:Forum browser
***************************
Buxon is a browser of instances of Forums represented in
SIOC ontology in RDF.
Buxon is part of the SWAML project:
http://swaml.berlios.de
REQUIREMENTS:
-------------
- python >= 2.4.0
- rdflib >= 2.4.0
- gtk+ >= 2.6.0
- pygtk >= 2.6.0
buxon-0.0.5/Makefile 0000644 0001750 0001750 00000001753 10763511161 013660 0 ustar sergio sergio # Buxon Makefile
NAME=SWAML
DESTDIR =
ZIP=gzip
install:
cp setup/buxon $(DESTDIR)/usr/bin/buxon
chmod 755 $(DESTDIR)/usr/bin/buxon
mkdir -p $(DESTDIR)/usr/share/buxon/
cp -r run.py src $(DESTDIR)/usr/share/buxon/
mkdir -p $(DESTDIR)/usr/share/buxon/includes/images
cp includes/images/calendar.xpm $(DESTDIR)/usr/share/buxon/includes/images/
cp -r includes/ui $(DESTDIR)/usr/share/buxon/includes/
mkdir -p $(DESTDIR)/usr/share/pixmaps
cp includes/images/rdf.xpm $(DESTDIR)/usr/share/pixmaps/buxon.xpm
mkdir tmp
$(ZIP) -9 -c manpages/buxon.1 > tmp/buxon.1.gz
mv tmp/buxon.1.gz $(DESTDIR)/usr/share/man/man1/
rm -r tmp
cp setup/buxon.desktop $(DESTDIR)/usr/share/applications/
uninstall:
rm -f $(DESTDIR)/usr/bin/buxon
rm -rf $(DESTDIR)/usr/share/buxon
rm -f $(DESTDIR)/usr/shar/pixmaps/buxon.xpm
rm -f $(DESTDIR)/usr/share/man/man1/buxon.1.gz
rm -f $(DESTDIR)/usr/share/applications/buxon.desktop
clean:
rm -rf buxon.cache
rm -f `find . -name "*~"`
rm -f `find . -name "*.pyc"`
buxon-0.0.5/run.py 0000755 0001750 0001750 00000006374 11625133547 013413 0 ustar sergio sergio #!/usr/bin/python
# -*- coding: utf8 -*-
# Buxon, a sioc:Forum Visor
#
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2006-2008 Sergio Fernández, Diego Berrueta
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""Buxon, a sioc:Forum browser"""
import sys
import os
import logging
import gtk
import gtk.glade
import pygtk
pygtk.require('2.0')
try:
import rdflib
from rdflib import sparql, Namespace
except:
print 'RDFLib is required'
sys.exit(-1)
#global vars
widgets = None
callbacks = None
buxon = None
class Callbacks:
def destroy(self):
return buxon.destroy()
def goButtonClicked(self):
uri = widgets.get_widget('urlInput').get_text()
if (uri != ''):
buxon.clear()
buxon.clearSearchForm()
buxon.messageBar( 'query on ' + uri)
buxon.uri = uri
buxon.drawTree(buxon.getPosts(uri))
def searchButtonClicked(self):
uri = buxon.getUri()
if (uri != None):
buxon.clear()
buxon.text.get_buffer().set_text('')
text = widgets.get_widget('searchInput').get_text()
min, max = buxon.getDates()
buxon.drawTree(buxon.getPosts(uri, min, max, text))
def selectRow(self, path, column):
buxon.showPost()
def fromButtonClicked(self):
from buxon.ui.calendarwindow import CalendarWindow
CalendarWindow(widgets.get_widget('fromEntry'))
def toButtonClicked(self):
from buxon.ui.calendarwindow import CalendarWindow
CalendarWindow(widgets.get_widget('toEntry'))
def alertButtonClicked(self):
buxon.alertWindow.destroy()
class BuxonMain:
def __init__(self, argv, base='./'):
"""
All operation that Buxon need to run
"""
#configure buxon logger
logging.basicConfig(level=logging.DEBUG, format="%(asctime)s %(levelname)s: %(message)s", stream=sys.stdout)
logging.info('Starting up Buxon main window')
sys.path.append(base + 'src')
from buxon.ui.buxonwindow import BuxonWindow
try:
global widgets
global callbacks
global buxon
widgets = gtk.glade.XML(base + 'includes/ui/graphical/buxon.glade')
callbacks = Callbacks()
widgets.signal_autoconnect(Callbacks.__dict__)
logging.debug('GUI loaded')
buxon = BuxonWindow(widgets, base)
if ('-h' in argv or '--help' in argv):
buxon.usage()
if (len(argv)>0):
buxon.main(argv[0])
else:
buxon.main()
except KeyboardInterrupt:
logging.info('Received Ctrl+C or another break signal. Exiting...')
sys.exit()
if __name__ == '__main__':
BuxonMain(sys.argv[1:])
buxon-0.0.5/COPYING 0000644 0001750 0001750 00000035427 10544506457 013271 0 ustar sergio sergio GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
buxon-0.0.5/ChangeLog 0000644 0001750 0001750 00000001250 11625134260 013761 0 ustar sergio sergio
2011-08-24 0.0.5 - Removed unnecessary dependency on Gazpacho
- Fixed some messages' printing
2008-03-05 0.0.4 - PingTheSemanticWeb.com support added
- Updated to the latest version of RDFLib
- Deleted dependency on SWAML core
- Redesigned fetcher and cache
- Fixed some minor bugs
2006-12-28 0.0.3 - Parted from SWAML
- Cache dump added
2006-11-21 0.0.2 - Minor bugs fixed
- New inheritance scheme for classes with any type of UI
- Added make file rules to install
2006-11-01 0.0.1 - First release
buxon-0.0.5/__init__.py 0000644 0001750 0001750 00000002077 11625134260 014330 0 ustar sergio sergio # Buxon, a sioc:Forum Visor
#
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2006-2008 Sergio Fernández, Diego Berrueta
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
__author__ = 'Sergio Fernández '
__contributors__ = ['Diego Berrueta ',
'Jose Emilio Labra ']
__copyright__ = 'Copyright 2005-2011, Sergio Fernández'
__license__ = 'GNU General Public License'
__version__ = '0.0.5'
__url__ = 'http://swaml.berlios.de/'
__agent__ = 'http://swaml.berlios.de/doap.rdf'
buxon-0.0.5/INSTALL 0000644 0001750 0001750 00000000643 11625127611 013247 0 ustar sergio sergio Installing Buxon
****************
Short Answer:
-------------
make install
Long Answer:
------------
Dependencies:
- python >= 2.4.0
- rdflib >= 2.4.0
- gtk+ >= 2.6.0
- pygtk >= 2.6.0
As root user you may run:
make install
This command will install Buxon at common directories. Then it'll be available
a new command: 'buxon'.
To uninstall it's also easy:
make uninstall
buxon-0.0.5/AUTHORS 0000644 0001750 0001750 00000000473 10665762637 013307 0 ustar sergio sergio
Authors and Maintainers
***********************
Maintainer:
Sergio Fernández
Project Managers:
Diego Berrueta
Jose E. Labra
Colaborators:
Iván Frade
Debian package:
Nacho Barrientos
buxon-0.0.5/manpages/buxon.1 0000644 0001750 0001750 00000001220 10763541152 015220 0 ustar sergio sergio .TH BUXON "1" "March 2008" "buxon" "User Commands"
.SH NAME
\fBbuxon\fP \- RDF sioc:Forum browser
.SH SYNOPSIS
\fBbuxon\fP [uri]
.SH DESCRIPTION
\fBbuxon\fP is a RDF sioc:Forum browser, created by the SWAML
developers as well and written in PyGTK.
.SH AUTHOR
Manpage written by Nacho Barrientos Arias and
Sergio Fernandez for the Debian GNU/Linux system
(but may be used by others).
.SH BUGS
Report bugs to http://swaml.berlios.de/bugs or to Debian BTS.
.SH COPYRIGHT
Copyright \(co 2006-2008, Sergio Fernandez. Licensed under GPLv2 license.
.PP
.nf
.fam C
http://swaml.berlios.de/
.SH "SEE ALSO"
.BR swaml (1)
buxon-0.0.5/setup/buxon 0000644 0001750 0001750 00000001737 10763541175 014450 0 ustar sergio sergio #!/usr/bin/python
# -*- coding: utf8 -*-
#
# SWAML
# Semantic Web Archive of Mailing Lists
#
# This is just a wrapper script for the Buxon main Python program.
#
# Copyright (C) 2007-2008 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
import sys
BUXON_PATH = '/usr/share/buxon/'
sys.path.append(BUXON_PATH)
try:
from run import BuxonMain
sys.exit(BuxonMain(sys.argv[1:], BUXON_PATH))
except ImportError:
print 'Buxon cannot be found; please, ensure that it is installed correctly.'
sys.exit(1)
buxon-0.0.5/setup/buxon.desktop 0000644 0001750 0001750 00000000277 10545163403 016106 0 ustar sergio sergio [Desktop Entry]
Type=Application
Encoding=UTF-8
Exec=/usr/bin/buxon %u
Terminal=false
Name=Buxon
Comment=sioc:Forum browser
Icon=buxon
MimeType=application/rdf+xml
Categories=Utility;Viewer;
buxon-0.0.5/src/buxon/__init__.py 0000644 0001750 0001750 00000001137 10752426013 016246 0 ustar sergio sergio # -*- coding: utf8 -*-
# Buxon
# a sioc:Forum browser
#
# Copyright (C) 2005-2008 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
buxon-0.0.5/includes/images/rdf.xpm 0000644 0001750 0001750 00000003122 10544575171 016574 0 ustar sergio sergio /* XPM */
static char * rdf_xpm[] = {
"30 32 32 1",
" c None",
". c #85A3CE",
"+ c #1A53A3",
"@ c #4875B6",
"# c #F1F4F9",
"$ c #2A5EA9",
"% c #4875B5",
"& c #678CC2",
"* c #396AAF",
"= c #E1E9F3",
"- c #D2DDED",
"; c #C2D1E6",
"> c #B3C6E1",
", c #1A52A3",
"' c #C3D2E7",
") c #7698C8",
"! c #3869AF",
"~ c #95AFD4",
"{ c #5881BC",
"] c #EFF3F8",
"^ c #A4BADA",
"/ c #E0E8F2",
"( c #295EA9",
"_ c #668CC1",
": c #7597C7",
"< c #B2C5E0",
"[ c #A3BADA",
"} c #94AED4",
"| c #5780BB",
"1 c #D1DCEC",
"2 c #FFFFFF",
"3 c #0B479D",
" @3,%33' ",
" 3|22.%:3& ",
" +_22333333- ",
" 32223333333 ",
" .|2333333333 ",
" @._333333333 ",
" {_3333333333 ",
" 33(333333333 ",
" *33!33333333~ ",
" +33333333333+ ",
" #..' .3333.'333333{ ",
" =33(%33*.$3333# #333$ ",
" -3:22:%.33333~ *33# ",
" 3}2233333333# '33 ",
"~32223333333- 33 ",
"$.]333333333 33 ",
"3;!333333333 33 ",
"@.3333333333= 33 ",
"'333333333333 -33- ",
" 3%33333333333> $33$ ",
" 33333333333333= ~3333. ",
" $33333= ^3333{.33/22;.3 ",
" ~3333,22333333 ",
" #333222333333~",
" =3!2.:3333333",
" 3.}333333333",
" 3.3333333333",
" @33333333333",
" #3:33333333'",
" @33333333+ ",
" @333333$ ",
" {33@# "};
buxon-0.0.5/includes/images/calendar.xpm 0000644 0001750 0001750 00000006410 10544575171 017575 0 ustar sergio sergio /* XPM */
static char * calendar_xpm[] = {
"20 16 161 2",
" c None",
". c #848B98",
"+ c #9D8990",
"@ c #BC8F96",
"# c #867D86",
"$ c #A4939B",
"% c #CD6466",
"& c #D36567",
"* c #D3696B",
"= c #B27175",
"- c #BE787D",
"; c #E17376",
"> c #94595B",
", c #B55052",
"' c #A56165",
") c #A1757B",
"! c #BC4F51",
"~ c #BF5154",
"{ c #C15356",
"] c #C55559",
"^ c #CB5D60",
"/ c #C25E61",
"( c #C76467",
"_ c #D96C6E",
": c #A25A5C",
"< c #634A4B",
"[ c #9B4043",
"} c #A94C4F",
"| c #A25659",
"1 c #B65759",
"2 c #AF4446",
"3 c #B14749",
"4 c #B65658",
"5 c #BB5F61",
"6 c #BD5D5F",
"7 c #C36668",
"8 c #CC7679",
"9 c #B76D6E",
"0 c #695557",
"a c #975052",
"b c #C17678",
"c c #C58081",
"d c #BE6F71",
"e c #B04E52",
"f c #B4575A",
"g c #C07273",
"h c #C98687",
"i c #CA8B8D",
"j c #CD9B9C",
"k c #E1BBBC",
"l c #DEC7C8",
"m c #969192",
"n c #6A5C5D",
"o c #936061",
"p c #C88788",
"q c #D29D9E",
"r c #D9ADAE",
"s c #D2ABAB",
"t c #D9B8BA",
"u c #D3BDBE",
"v c #9A8D8D",
"w c #8D8586",
"x c #969595",
"y c #EBEBEB",
"z c #F6F6F6",
"A c #B8B8B8",
"B c #A79C9D",
"C c #F3E6E7",
"D c #F8F0F0",
"E c #F5F1F1",
"F c #ACAAAA",
"G c #B6B5B5",
"H c #D6D5D5",
"I c #999999",
"J c #888888",
"K c #898A8A",
"L c #ECECEC",
"M c #FBFBFB",
"N c #CACACB",
"O c #A1A2A3",
"P c #FFFFFF",
"Q c #ACACAC",
"R c #565656",
"S c #8E8E8E",
"T c #F3F3F3",
"U c #F7F7F7",
"V c #A7A7A7",
"W c #B4B4B4",
"X c #FEFEFE",
"Y c #D9D9DA",
"Z c #9B9C9C",
"` c #EBECEC",
" . c #E9E9E9",
".. c #AEAEAE",
"+. c #878787",
"@. c #EAEAEA",
"#. c #EDEDED",
"$. c #929292",
"%. c #C3C3C3",
"&. c #FCFCFC",
"*. c #F9F9FA",
"=. c #E0E0E1",
"-. c #ABACAD",
";. c #949595",
">. c #E1E1E1",
",. c #D2D2D2",
"'. c #7F7F7F",
"). c #DFDFDF",
"!. c #E7E7E7",
"~. c #868686",
"{. c #C7C7C7",
"]. c #F4F4F4",
"^. c #E1E1E2",
"/. c #C9CACC",
"(. c #9D9EA0",
"_. c #8D8E8F",
":. c #D5D5D5",
"<. c #E2E2E2",
"[. c #8A8A8A",
"}. c #D4D4D4",
"|. c #F0F0F0",
"1. c #BCBDBD",
"2. c #C8C9CB",
"3. c #C1C2C3",
"4. c #B7B8B9",
"5. c #BDBEBF",
"6. c #9A9B9D",
"7. c #C4C5C5",
"8. c #F8F8F9",
"9. c #F1F1F1",
"0. c #D7D7D9",
"a. c #C4C3C6",
"b. c #B3B3B4",
"c. c #B0AFB0",
"d. c #B9B8BA",
"e. c #ACABAD",
"f. c #929293",
"g. c #6B6C6D",
"h. c #AAAAAB",
"i. c #D3D3D4",
"j. c #C5C5C6",
"k. c #B2B2B3",
"l. c #A3A2A4",
"m. c #9A9A9B",
"n. c #8B8A8C",
"o. c #858587",
"p. c #7D7C7E",
"q. c #6F6F71",
"r. c #666768",
"s. c #636465",
"t. c #5D5E60",
"u. c #777778",
"v. c #7F7F80",
"w. c #79797A",
"x. c #767677",
"y. c #707072",
"z. c #6E6F70",
"A. c #6F7071",
"B. c #6C6D6E",
"C. c #6C6C6D",
"D. c #717272",
" . ",
" + @ ",
" # $ % & * = - ; > ",
" , ' ) ! ~ { ] ^ / ( _ : ",
"< [ } | 1 2 3 4 5 6 7 8 9 ",
"0 a b c d e f g h i j k l m ",
"n o p q r s t u v w x y z A ",
" B C D E F G H I J K L M N ",
" O z P Q R S T U V W M X Y ",
" Z ` P ...+.@.#.$.%.&.*.=.-. ",
" ;.>.P X ,.'.).!.~.{.].^./.(. ",
" _.:.X P <.[.}.|.1.2.3.4.5.6. ",
" 7.8.U 9.!.0.a.b.c.d.e.f.g. ",
" h.i.j.k.l.m.n.o.p.q.r.s.t. ",
" u.v.w.x.y.z.A.B. ",
" C.D.A. "};
buxon-0.0.5/src/buxon/ui/buxonwindow.py 0000644 0001750 0001750 00000021017 10763547535 017525 0 ustar sergio sergio
import os
from buxon.ui.gtkui import GtkUI
import gtk
import pango
from buxon.rdf.cache import Cache
from buxon.rdf.namespaces import SIOC, RDF, DC, DCTERMS
from buxon.ui.loadprogressbar import LoadProgressBar
class BuxonWindow(GtkUI):
def clear(self):
"""
Clear all GTK components on Buxon
"""
#tree
self.treeTranslator = {}
for column in self.treeView.get_columns():
self.treeView.remove_column(column)
#text
self.text.get_buffer().set_text('')
def clearSearchForm(self):
"""
Clear search form
"""
self.widgets.get_widget('searchInput').set_text('')
self.widgets.get_widget('fromEntry').set_text('01/01/1995')
self.widgets.get_widget('toEntry').set_text('31/31/2010')
def showPost(self):
"""
Show post selected at gtk.TreeView
"""
selection = self.treeView.get_selection()
(model, iter) = selection.get_selected()
uri = model.get_value(iter, 0)
author, authorUri, listName, listUri, title, date, content = self.cache.getPost(uri)
self.messageBar('loaded post ' + uri)
self.writePost(uri, author, authorUri, listName, listUri, title, date, content)
def writePost(self, uri, author=None, authorUri='', listName=None, listUri='', title='', date='', content=''):
"""
Write a post on the gtkTextView
@param uri: post uri
@param author: author's name
@param authorUri: author's uri
@param listName: mailing list's name
@param listUri: mailing list's uri
@param title: post subject
@param date: post date
@param content: post body
"""
PANGO_SCALE = 1024
buffer = self.text.get_buffer()
buffer.set_text('')
iter = buffer.get_iter_at_offset(0)
buffer.insert(iter, '\n')
buffer.insert_with_tags_by_name(iter, 'Post URI: \t', 'bold')
buffer.insert_with_tags_by_name(iter, uri, 'monospace')
buffer.insert(iter, '\n')
buffer.insert_with_tags_by_name(iter, 'From: \t', 'bold')
if (author == None):
buffer.insert_with_tags_by_name(iter, authorUri, 'monospace')
else:
buffer.insert(iter, author)
buffer.insert(iter, ' <')
buffer.insert_with_tags_by_name(iter, authorUri, 'monospace')
buffer.insert(iter, '>')
buffer.insert(iter, '\n')
buffer.insert_with_tags_by_name(iter, 'To: \t\t', 'bold')
if (listName == None):
buffer.insert_with_tags_by_name(iter, listUri, 'monospace')
else:
buffer.insert(iter, listName)
buffer.insert(iter, ' <')
buffer.insert_with_tags_by_name(iter, listUri, 'monospace')
buffer.insert(iter, '>')
buffer.insert(iter, '\n')
buffer.insert_with_tags_by_name(iter, 'Subject: \t', 'bold')
buffer.insert(iter, title)
buffer.insert(iter, '\n')
buffer.insert_with_tags_by_name(iter, 'Date: \t', 'bold')
buffer.insert(iter, date)
buffer.insert(iter, '\n\n')
buffer.insert_with_tags_by_name(iter, content, 'wrap_mode')
buffer.insert(iter, '\n')
def getDates(self):
"""
Get selected dates
@return: dates
@rtype: tuple
"""
#min date
fromDate = self.widgets.get_widget('fromEntry').get_text().split('/')
min = float(fromDate[2]) * 10000000000
min += float(fromDate[1]) * 100000000
min += float(fromDate[0]) * 1000000
#max date
toDate = self.widgets.get_widget('toEntry').get_text().split('/')
max = float(toDate[2]) * 10000000000
max += float(toDate[1]) * 100000000
max += float(toDate[0]) * 1000000
return min, max
def getPosts(self, uri, min=None, max=None, text=None):
"""
Get mailing list's posts
@param uri: mailing list's uri
@param min: min date
@param max: max date
@param text: text to search
"""
if (self.cache == None):
pb = LoadProgressBar()
self.cache = Cache(uri, self.checkping.get_active(), pb)
else:
if (uri!=self.cache.uri or not bool(self.cache.graph)):
pb = LoadProgressBar()
self.cache = Cache(uri, self.checkping.get_active(), pb)
min, max = self.getDates()
if bool(self.cache.graph):
posts = self.cache.query()
if (posts == None):
self.messageBar('unknow problem parsing RDF at ' + self.uri)
return None
else:
if (min!=None or max!=None or text!=None):
posts = self.cache.filterPosts(posts, min, max, text)
return posts
else:
self.alert('An exception ocurred parsing this URI')
return None
def drawTree(self, posts):
"""
Draw post on gtk.TreeView
@param posts: posts
@type posts: tuple
"""
if (posts!=None and len(posts)>0):
#create tree
self.treeStore = gtk.TreeStore(str, str)
self.treeView.set_model(self.treeStore)
#append items
parent = None
for (post, title, date, creator, content, parent) in posts:
self.treeTranslator[post] = self.treeStore.append(self.__getParent(parent), [str(post), str(title)])
#print 'drawing post', post, 'on tree'
#and show it
treeColumn = gtk.TreeViewColumn('Posts')
self.treeView.append_column(treeColumn)
cell = gtk.CellRendererText()
treeColumn.pack_start(cell, True)
treeColumn.add_attribute(cell, 'text', 1)
treeColumn.set_sort_column_id(0)
self.messageBar('loaded ' + self.cache.uri)
else:
self.messageBar('no posts found at ' + self.cache.uri)
def __getParent(self, uri):
"""
Get the parent post
@param uri: post uri
@return: parent uri
"""
if (uri in self.treeTranslator):
return self.treeTranslator[uri]
else:
return None
def messageBar(self, text):
"""
Write a message on the status bar
@param text: text
"""
self.statusbar.push(0, text)
def insertBufferTag(self, buffer, name, property, value):
"""
Insert a new tag on buffer
@param buffer: buffer
@param name: tag name
@param property: property to customize
@param value: property value
"""
tag = gtk.TextTag(name)
tag.set_property(property, value)
table = buffer.get_tag_table()
table.add(tag)
def getUri(self):
"""
Get actual URI
@return: actual uri
"""
if (self.cache == None):
return None
else:
return self.cache.uri
def destroy(self):
"""
Destoy all the infraestructure
"""
print 'Exiting...'
gtk.main_quit()
return gtk.FALSE
def main(self, uri=None):
"""
Main bucle
@param uri: uri
"""
#widgets
self.treeView = self.widgets.get_widget('postsTree')
self.text = self.widgets.get_widget('buxonTextView')
buffer = self.text.get_buffer()
self.insertBufferTag(buffer, 'bold', 'weight', pango.WEIGHT_BOLD)
self.insertBufferTag(buffer, 'monospace', 'family', 'monospace')
self.insertBufferTag(buffer, 'wrap_mode', 'wrap_mode', gtk.WRAP_WORD)
self.input = self.widgets.get_widget('urlInput')
self.checkping = self.widgets.get_widget('checkping')
self.statusbar = self.widgets.get_widget('buxonStatusbar')
self.messageBar('ready')
#main window
self.window = self.widgets.get_widget('buxon')
if (os.path.exists('/usr/share/pixmaps/buxon.xpm')):
self.window.set_icon_from_file('/usr/share/pixmaps/buxon.xpm')
else:
self.window.set_icon_from_file(self.base + 'includes/images/rdf.xpm')
self.window.show()
if (uri != None):
self.input.set_text(uri)
gtk.main()
def __init__(self, widgets, base='./'):
"""
Buxon constructor
@param base: base directory
"""
GtkUI.__init__(self, 'buxon', base)
self.base = base
self.widgets = widgets
self.cache = None
self.treeTranslator = {}
buxon-0.0.5/src/buxon/ui/gtkui.py 0000644 0001750 0001750 00000005355 10763547030 016262 0 ustar sergio sergio # -*- coding: utf8 -*-
#
# Buxon, a sioc:Forum Visor
#
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2005-2008 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
import gtk
from buxon.ui.ui import UI
class GtkUI(UI):
"""
Abstract class for GTK User Interfaces
"""
def usage(self):
"""
Print usage information
"""
path = self.lineBase + 'usage/' + self.id + '.txt'
try:
for line in open(path):
print line,
except IOError, details:
print 'Problem reading from ' + path + ': ' + str(details)
sys.exit()
def alert(self, text):
"""
Alert window
@param text: text on alert
"""
self.alertWindow = gtk.Window(gtk.WINDOW_POPUP)
self.alertWindow.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.alertWindow.set_modal(True)
self.alertWindow.set_resizable(False)
self.alertWindow.set_border_width(0)
vbox = gtk.VBox(False, 5)
vbox.set_border_width(10)
self.alertWindow.add(vbox)
vbox.show()
align1 = gtk.Alignment(0.5, 0.5, 0, 0)
vbox.pack_start(align1, False, False, 5)
align1.show()
label = gtk.Label(text)
align1.add(label)
label.show()
align2 = gtk.Alignment(0.5, 0.5, 0, 0)
vbox.pack_start(align2, False, False, 5)
align2.show()
button = gtk.Button('OK')
button.connect('clicked', self.destroyAlert, 'cool button')
align2.add(button)
button.show()
self.alertWindow.show()
def destroyAlert(self, widget=None, other=None):
"""
Destroy aler window
@param widget: widget
@param other: other
"""
self.alertWindow.destroy()
def __init__(self, id=None, base='./'):
"""
Constructor method
@param id: string id
@param base: base directory
"""
UI.__init__(self, id, base)
self.lineBase = self.base + 'includes/ui/text/'
self.graphicalBase = self.base + 'includes/ui/graphical/'
buxon-0.0.5/src/buxon/ui/calendarwindow.py 0000644 0001750 0001750 00000004647 10752426013 020136 0 ustar sergio sergio # -*- coding: utf8 -*-
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2005-2006 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""gtk.CalendarWindow"""
import sys
import gtk, pygtk
import time
class CalendarWindow:
def selectDay(self, widget):
"""
Select a day
@param widget: widget
"""
self.window.destroy()
def destroy(self, widget):
"""
Destroy window
@param widget: widget
"""
self.setText(self.getDate())
def setText(self, text):
"""
Set text on text entry
@param text: text
"""
self.entry.set_text(text)
def getDate(self):
"""
Get selected date
@return: date in string format
"""
year, month, day = self.calendar.get_date()
return str(day) + '/' + str(month+1) + '/' + str(year)
def setInitialDate(self):
"""
Load initial date
"""
date = self.entry.get_text().split('/')
day = int(date[0])
month = int(date[1])
year = int(date[2])
if (self.calendar != None):
self.calendar.select_month(month-1, year)
self.calendar.select_day(day)
def __init__(self, entry):
"""
CalendarWindow constructor
"""
self.entry = entry
self.window = gtk.Window(gtk.WINDOW_POPUP)
self.window.connect('destroy', self.destroy)
self.window.set_position(gtk.WIN_POS_MOUSE)
self.window.set_modal(True)
self.window.set_resizable(False)
self.calendar = gtk.Calendar()
self.calendar.connect('day_selected_double_click', self.selectDay)
self.setInitialDate()
self.window.add(self.calendar)
self.calendar.show()
self.window.show()
buxon-0.0.5/src/buxon/ui/__init__.py 0000644 0001750 0001750 00000001137 10752426013 016663 0 ustar sergio sergio # -*- coding: utf8 -*-
# Buxon
# a sioc:Forum browser
#
# Copyright (C) 2005-2008 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
buxon-0.0.5/src/buxon/ui/ui.py 0000644 0001750 0001750 00000002127 10752426013 015541 0 ustar sergio sergio # -*- coding: utf8 -*-
#
# Buxon, a sioc:Forum Visor
#
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2005-2008 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""Common functions for UIs"""
import sys, os, string
class UI:
"""
Abstract class for User Interfaces
"""
def usage(self):
"""
Print usage information
"""
pass
def __init__(self, id=None, base='./'):
"""
Constructor method
@param id: string id
@param base: base directory
"""
self.id = id
self.base = base
buxon-0.0.5/src/buxon/ui/loadprogressbar.py 0000644 0001750 0001750 00000004051 10752426013 020313 0 ustar sergio sergio # -*- coding: utf8 -*-
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2005-2006 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""gtk.ProgressBar for heavy works"""
import sys
import gtk, pygtk, gobject
class LoadProgressBar:
"""
ProgressBar for load events
"""
def destroy(self, widget=None):
"""
Destroy
@param widget: widget
"""
self.window.destroy()
def progress(self):
"""
Update the value of the progress bar
"""
new_val = self.pbar.get_fraction() + 0.01
if new_val > 1.0:
new_val = 0.0
self.pbar.set_fraction(new_val)
return True
def __init__(self):
"""
PorgressBarLoad constructor
"""
self.window = gtk.Window(gtk.WINDOW_POPUP)
self.window.set_position(gtk.WIN_POS_CENTER_ALWAYS)
self.window.set_modal(True)
self.window.set_resizable(False)
self.window.connect('destroy', self.destroy)
self.window.set_border_width(0)
vbox = gtk.VBox(False, 5)
vbox.set_border_width(10)
self.window.add(vbox)
vbox.show()
# Create a centering alignment object
align = gtk.Alignment(0.5, 0.5, 0, 0)
vbox.pack_start(align, False, False, 5)
align.show()
# Create the ProgressBar
self.pbar = gtk.ProgressBar()
self.pbar.set_text('loading...')
align.add(self.pbar)
self.pbar.show()
self.progress()
self.window.show()
buxon-0.0.5/src/buxon/rdf/cache.py 0000644 0001750 0001750 00000013660 11625133547 016340 0 ustar sergio sergio # -*- coding: utf8 -*-
#
# Buxon, a sioc:Forum Visor
#
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2006-2007 Sergio Fernández, Diego Berrueta
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""a cache service for sioc:Forum"""
import logging
from rdflib import URIRef
from rdflib.Graph import ConjunctiveGraph
from rdflib.sparql.sparqlGraph import SPARQLGraph
from rdflib.sparql.graphPattern import GraphPattern
from rdflib.sparql import Query
from rdflib import Namespace
from buxon.rdf.fetcher import Fetcher
from buxon.rdf.namespaces import SIOC, RDF, RDFS, DC, DCTERMS
from buxon.common.date import MailDate
class Cache:
def orderByDate(self, posts):
"""
Order by date a list of posts
@param posts: posts to order
@return: posts ordered
"""
#SPARQL in RDFLib doesn't support 'ORDER BY' queries
#then we'll implement a rustic support to order by dates
#state: testing
#extract dates in integer long format
dict = {}
dates = []
for (post, title, date, creator, content, parent) in posts:
intDate = MailDate(date).getInteger()
dates.append(intDate)
dict[intDate] = (post, title, date, creator, content, parent)
#and we put ordered into a new list
dates.sort()
ordered = []
for date in dates:
ordered.append(dict[date])
return ordered
def filterPosts(self, posts, min=None, max=None, text=None):
"""
Filter post from some conditions
@param posts: list of posts
@param min: min date
@param max: max date
@param text: text to search
"""
filtered = []
for (post, title, date, creator, content, parent) in posts:
intDate = MailDate(date).getInteger()
#exist if date is bigger
if (max!=None and intDate>max):
break
#continue if is smaller
if (min!=None and intDate 0):
return value[0]
else:
return None
def query(self):
"""
Make a SPARQL query
@return: posts result
"""
sparqlGr = SPARQLGraph(self.graph)
select = ('?post', '?postTitle', '?date', '?userName', '?content', '?parent')
where = GraphPattern([('?post', RDF['type'], SIOC['Post']),
('?post', DC['title'], '?postTitle'),
('?post', DCTERMS['created'], '?date'),
('?post', SIOC['content'], '?content'),
('?post', SIOC['has_creator'], '?user'),
('?user', SIOC['name'], '?userName')])
opt = GraphPattern([('?post', SIOC['reply_of'], '?parent')])
posts = Query.query(sparqlGr, select, where, opt)
return self.orderByDate(posts)
def getPostAuthor(self, post):
"""
Get author of a post
@param post: post uri
"""
authorUri = self.getValueForPredicate(post, SIOC['has_creator'])
author = self.getValueForPredicate(authorUri, SIOC['name'])
return author, authorUri
def getPost(self, uri):
"""
Get fields of a post
@param uri: post uri
@return: post fields
"""
author, authorUri = self.getPostAuthor(uri)
listUri = self.getValueForPredicate(uri, SIOC['has_container'])
listName = self.getValueForPredicate(listUri, DC['title'])
title = self.getValueForPredicate(uri, DC['title'])
date = self.getValueForPredicate(uri, DCTERMS['created'])
content = self.getValueForPredicate(uri, SIOC['content'])
return author, authorUri, listName, listUri, title, date, content
def dump(self, path='cache.rdf'):
"""
Dump graph on disk
@param path: path to dump
"""
if bool(self.graph):
try:
file = open(path, 'w+')
self.graph.serialize(destination=file, format="pretty-xml")
file.flush()
file.close()
except IOError, detail:
print 'Error dumping cache: ' + str(detail)
def __init__(self, uri, ping, pb=None):
"""
Cache constructor
@param uri: uri to load
@param pb: progress bar
"""
self.uri = uri
fetcher = Fetcher(uri, ping, pb)
self.graph = fetcher.getData()
buxon-0.0.5/src/buxon/rdf/fetcher.py 0000644 0001750 0001750 00000013421 11625133547 016710 0 ustar sergio sergio # -*- coding: utf8 -*-
#
# Buxon, a sioc:Forum Visor
#
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2006-2008 Sergio Fernández, Diego Berrueta
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""a cache service for sioc:Forum"""
import logging
from rdflib import URIRef
from rdflib.Graph import ConjunctiveGraph
from rdflib.sparql.sparqlGraph import SPARQLGraph
from rdflib.sparql.graphPattern import GraphPattern
from rdflib.sparql import Query
from rdflib import Namespace
from buxon.rdf.namespaces import SIOC, RDF, RDFS, DC, DCTERMS
from buxon.rdf.ptsw import PTSW
import socket
import gtk
class Fetcher:
def __listPosts(self):
"""
List post at cache
"""
try:
sparqlGr = SPARQLGraph(self.graph)
select = ('?post', '?title')
where = GraphPattern([('?post', RDF['type'], SIOC['Post']),
('?post', DC['title'], '?title')])
posts = Query.query(sparqlGr, select, where)
logging.info(len(posts) + ' posts:')
for post, title in posts:
try:
logging.info(post + " " + title)
except:
logging.info(post + ' (bad formed title)')
except Exception, details:
logging.error('parsing exception:' + str(details))
return None
def loadMailingList(self, uri):
"""
Load a mailing list into a graph memory
@param uri: mailing list's uri
"""
graph = ConjunctiveGraph()
logging.debug('Getting mailing list data (' + uri + ')...')
graph.parse(uri)
logging.info('OK, loaded ' + str(len(graph)) + ' triples')
forums = self.__getForums(graph)
if forums.__len__() < 1:
return None
self.uri = forums[0]
logging.info('Using ' + self.uri + ' sioc:Forum')
if (self.pb != None):
self.pb.progress()
if (self.ptsw != None):
self.ptsw.ping(uri)
return graph
def __loadData(self, uri):
"""
Load data
@param uri: uri to load
"""
logging.debug('Resolving reference to get additional data (' + uri + ')...')
try:
self.graph.parse(uri)
except:
logging.error('An exception ocurred parsing ' + uri)
return
if (self.pb != None):
self.pb.progress()
while gtk.events_pending():
gtk.main_iteration()
if (self.ptsw != None):
self.ptsw.ping(uri)
logging.debug('OK, now ' + str(len(self.graph)) + ' triples')
def __getForums(self, graph):
"""
Get all sioc:Forum's in a graph
"""
sparqlGr = SPARQLGraph(graph)
select = ('?uri')
where = GraphPattern([('?uri', RDF['type'], SIOC['Forum'])])
forums = Query.query(sparqlGr, select, where)
return forums;
def loadAdditionalData(self):
"""
Load additional data of a mailing list
"""
for post in self.graph.objects(self.uri, SIOC['container_of']):
if not self.hasValueForPredicate(post, SIOC['id']):
postSeeAlso = self.getValueForPredicate(post, RDFS['seeAlso'])
if (postSeeAlso == None):
self.__loadData(post)
else:
self.__loadData(postSeeAlso)
for user in self.graph.objects(predicate=SIOC['has_subscriber']):
if not self.hasValueForPredicate(user, SIOC['email_sha1']):
self.__loadData(user)
def hasValueForPredicate(self, subject, predicate):
"""
Get if a predicate exists
@param subject: subject
@param predicate: predicate
"""
return (len([x for x in self.graph.objects(URIRef(subject), predicate)]) > 0)
def getValueForPredicate(self, subject, predicate):
"""
Get value of a predicate
@param subject: subject
@param predicate: predicate
"""
value = [x for x in self.graph.objects(URIRef(subject), predicate)]
if (len(value) > 0):
return value[0]
else:
return None
def getData(self):
try:
self.graph = self.loadMailingList(self.uri)
except Exception, details:
logging.error('An exception ocurred parsing ' + self.uri + ': ' + str(details))
self.bad = True
return
if self.graph == None:
self.bad = True
logging.error('None sioc:Forum founded on ' + self.uri)
else:
self.loadAdditionalData()
#self.__listPosts()
if (self.pb != None):
self.pb.destroy()
if (self.ptsw != None):
logging.debug(self.ptsw.stats())
if self.bad:
return None
else:
logging.info('Total triples loaded: ' + str(len(self.graph)))
return self.graph
def __init__(self, base, ping, pb=None):
"""
Cache constructor
@param base: base uri to load
@param pb: progress bar
"""
self.uri = base
self.graph = None
self.bad = False
self.pb = pb
self.ptsw = None
if ping:
self.ptsw = PTSW()
socket.setdefaulttimeout(5)
buxon-0.0.5/src/buxon/rdf/namespaces.py 0000644 0001750 0001750 00000002421 10752426013 017376 0 ustar sergio sergio # -*- coding: utf8 -*-
# SWAML KML Exporter
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2005-2007 Sergio Fernández, Diego Berrueta
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""Common namespaces"""
from rdflib import Namespace
RDF = Namespace(u'http://www.w3.org/1999/02/22-rdf-syntax-ns#')
RDFS = Namespace(u'http://www.w3.org/2000/01/rdf-schema#')
SIOC = Namespace(u'http://rdfs.org/sioc/ns#')
SIOCT = Namespace(u'http://rdfs.org/sioc/types#')
DC = Namespace(u'http://purl.org/dc/elements/1.1/')
DCTERMS = Namespace(u'http://purl.org/dc/terms/')
FOAF = Namespace(u'http://xmlns.com/foaf/0.1/')
GEO = Namespace(u'http://www.w3.org/2003/01/geo/wgs84_pos#')
MVCB = Namespace(u'http://webns.net/mvcb/')
ICAL = Namespace(u'http://www.w3.org/2002/12/cal/icaltzd#')
XSD = Namespace(u'http://www.w3.org/2001/XMLSchema#')
buxon-0.0.5/src/buxon/rdf/__init__.py 0000644 0001750 0001750 00000001137 10752426013 017021 0 ustar sergio sergio # -*- coding: utf8 -*-
# Buxon
# a sioc:Forum browser
#
# Copyright (C) 2005-2008 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
buxon-0.0.5/src/buxon/rdf/ptsw.py 0000644 0001750 0001750 00000004113 10761764622 016267 0 ustar sergio sergio # -*- coding: utf8 -*-
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2005-2008 Sergio Fernández, Iván Frade
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""PingTheSemanticWeb.com wrapper"""
import urllib, urllib2
from xml.dom import minidom
class PTSW:
def __init__(self):
self.rest = "http://pingthesemanticweb.com/rest/?url="
self.pinged = 0
def ping(self, uri):
try:
import socket
socket.setdefaulttimeout(5)
url = self.rest + urllib.quote(uri)
data = {}
headers = { 'User-Agent' : 'swaml (http://swaml.berlios.de/; sergio@wikier.org)' }
request = urllib2.Request(url, data, headers)
response = urllib2.urlopen(request).read()
responseParsed = self.parseResponse(response)
if (responseParsed['flerror'] == 0):
self.pinged += 1
return True
else:
return False
except:
return False
def parseResponse(self, response):
dom = minidom.parseString(response)
responses = dom.getElementsByTagName('response')
dict = {}
for node in responses[0].childNodes:
if (not node.nodeType == node.TEXT_NODE):
key = node.nodeName
try:
value = int(node.firstChild.data)
except:
value = node.firstChild.data
dict[key] = value
return dict
def stats(self):
return str(self.pinged) + ' files pinged to PingTheSemanticWeb.com'
buxon-0.0.5/src/buxon/common/__init__.py 0000644 0001750 0001750 00000001137 10752426013 017536 0 ustar sergio sergio # -*- coding: utf8 -*-
# Buxon
# a sioc:Forum browser
#
# Copyright (C) 2005-2008 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
buxon-0.0.5/src/buxon/common/date.py 0000644 0001750 0001750 00000010100 11625133547 016711 0 ustar sergio sergio # -*- coding: utf8 -*-
# SWAML
# Semantic Web Archive of Mailing Lists
#
# Copyright (C) 2005-2007 Sergio Fernández
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by the
# Free Software Foundation; either version 2, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
# for more details.
"""Utils functions to work with dates"""
import sys, os, string
import email.Utils
import time
import logging
class Date:
def __init__(self, date):
"""
Date constructor
"""
self.date = date
def getDay(self):
"""
Get day value
"""
return self.date[2]
def getStringDay(self):
"""
Get day as string
"""
day = self.getDay()
if (day < 10):
return ('0' + str(day))
else:
return str(day)
def getMonth(self):
"""
Get month value
"""
return self.date[1]
def getStringMonth(self):
"""
Get month in string number format
"""
month = self.getMonth()
if (month < 10):
return ('0' + str(month))
else:
return str(month)
def getShortStringMonth(self):
"""
Get month in short string format
"""
shortMonths = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
return shortMonths[self.getMonth() - 1]
def getLongStringMonth(self):
"""
Get month in long string format
"""
longMonths = ['January', 'February', 'March', 'April',
'May', 'June', 'July', 'August',
'September', 'October', 'November', 'December']
return longMonths[self.getMonth() - 1]
def getYear(self):
"""
Get year value
"""
return self.date[0]
def getStringYear(self):
"""
Get year string
"""
return str(self.getYear())
def getNumericFormat(self):
"""
Get int values
"""
return [self.getYear(), self.getMonth(), self.getDay()]
def getInteger(self):
"""
Get long int value
"""
return (self.date[0]*10000000000 + self.date[1]*100000000 +
self.date[2]*1000000 + self.date[3]*10000 +
self.date[4]*100 + self.date[5])
def getStringFormat(self, format='iso'):
"""
Get string format
@param format: standar
"""
year = self.getStringYear()
month = self.getStringMonth()
day = self.getStringDay()
if(format == 'normal'):
#normal format: day-month-year
return day + '-' + month + '-' + year
else:
#iso: year-month-day
return year + '-' + month + '-' + day
class MailDate(Date):
"""
Utils functions for date of emails
"""
def __init__(self, date):
"""
MailDate constructor
"""
self.date = email.Utils.parsedate(date)
if (self.date == None):
logging.error('Error parsing none date, trying alternatives...')
#trying another format: dd.mm.yyyy
try:
tmp = date.split('.')
self.date = (int(tmp[2]), int(tmp[1]), int(tmp[0]),
0, 0, 0, 0, 1, -1)
except:
self.date = (1970, 1, 1, 0, 0, 0, 0, 1, -1)
class FileDate(Date):
"""
Utils functions for date of files
"""
def __init__(self, path):
"""
FileDate constructor
"""
self.date = time.localtime(os.stat(path)[8])
buxon-0.0.5/includes/ui/graphical/buxon.glade 0000644 0001750 0001750 00000066027 10635553613 020541 0 ustar sergio sergio
Copy
Copy selected object into the clipboard
gtk-copy
Cut
Cut selected object into the clipboard
gtk-cut
New
Create a new file
gtk-new
Open
Open a file
gtk-open
Paste
Paste object from the Clipboard
gtk-paste
Quit
Quit the program
gtk-quit
Save
True
Save a file
gtk-save
SaveAs
Save with a different name
gtk-save-as
6
1
1
Buxon, a sioc:Forum browser
dialog
center
6
True
6
6
True
middle
URI:
urlInput
True
0.0
20
False
False
True
http://
True
500
1
False
PingTheSemanticWeb.com
True
False
2
True
gtk-jump-to
True
True
100
3
False
True
6
True
automatic
True
automatic
False
False
400
True
True
0
True
0
6
Search
etched-out
etched-out
True
True
6
True
Text:
True
0.0
6
True
True
250
1
6
6
True
False
True
10
01/01/1995
True
10
2
True
True
True
True
../../images/calendar.xpm
True
From
True
1
1
True
2
False
31/12/2010
True
10
3
2
True
True
True
../../images/calendar.xpm
True
To
True
1
4
1
6
True
gtk-find
True
True
2
False
False
1
False
6
never
True
True
automatic
False
6
True
6
6
True
word
1
1
True
False
False
2
buxon-0.0.5/includes/ui/text/usage/buxon.txt 0000644 0001750 0001750 00000000325 10544506457 020432 0 ustar sergio sergio
Usage: buxon [uri]
Read a Forum published in SIOC vocabulary.
uri : forum's uri
Options:
-h, --help : print this help message and exit.
Report bugs to: