Archive for the ‘Tools, Frameworks & Best Practices’ Category.

Relations API enhancement

Just posted a patch: Expanded predicates for Relations API that gets one step closer to being able to combine free tagging with RDF. Basically the idea is simple: use the existing free tagging capabilities of Drupal to let users build up a smart domain-specific vocabulary, and use those words as predicates in RDF statements. I’m kind of surprised there didn’t seem to already be an easy way to do this.

The patch above does the step of including the vocabulary terms as predicates for Relations API. I still need to do another patch, probably to taxonomy_xml, to automatically expose them as RDF, and then expose something that makes it easy to output them in nice clean RDFa with the nodes. Once that is done, it seems pretty powerful to me. I like being able to write something and in a structured way say it was inspired by a book, that it implements a philosophy, or that it is useful for some specific goal.

This is partly done at bteaching.com now; the relations are visible to the user along with each node. They aren’t output in RDFa yet, though, that still needs to be done along with the automatic vocabulary exposure as RDF.

Anyway, I wanted to post what I have so far, as its in production on a live site and might be useful for someone else in its current form.

The Drupal Way

Just fifteen years ago, few organizations had websites. Those that did, owed thanks to some nerdy staffers or volunteers who had heard about the web, learned HTML, and hacked something together. Fast forward to today: most organizations, millions of people as well as several dogs, cats and birds have their own websites. Such proliferation has been assisted by numerous standards and tools that have emerged to aid with creating, editing and maintaining said sites. For most organizations, the key tool is a Content Management System (CMS); others design and build their own web application using a coding framework. Drupal is a bit of both, CMS and application coding framework.

Note, Drupal is by no means the only or necessarily the best choice for site building. Choices abound: Wordpress for simplicity and elegance, CodeIgniter or Symphony for efficient PHP application coding, newcomers such as CubicWeb built on emerging semantic standards – google ‘choosing a CMS’ if looking for advice on selecting a system for a new site.

Suppose, however, that you have inherited a Drupal site or have chosen Drupal on its merits as a mature, open source platform with a thriving community of users and developers and a plethora of modules to perform nearly every conceivable web task. Then it behooves you to understand the Drupal Way of avoiding pain and achieving maintainability.
Continue reading ‘The Drupal Way’ »

Drupal 6 semantic support

Drupal 6 generally is a solid version, notwithstanding the INSTALL.txt issue. It has good RDF support as well, including the ability to add and manipulate arbitrary triples using the RDF module. The Relations API module provides an easy user interface to add SeeAlso relations to nodes, but not to include nodes in arbitrary triples.

From the README.txt that comes with the Relations API: ” Currently supports bidirectional node relationships based on the rdfs:seeAlso predicate. This could in the future fairly easily be extended to include support for user-defined predicates and for unidirectional relationships.” – so this was part of the possible future plans, at least.

Since most of the RDF work appears now to be focusing on Drupal 7, I’m hoping that arbitrary relations make it in there. What I would really like to see is the use of the taxonomy terms vocabulary that the RDF module auto-generates used as the predicate set – that would essentially reach the “en:anyword” goal mentioned below, and in a widely used CMS! Perhaps this will be possible by extending the Relations API. For now, using it in standard form at a teaching tips site, http://bteaching.com

Do NOT follow the instructions in Drupal 6 INSTALL.txt …

So, I am ping-ponging around in my spare-time quest for the best way to quickly add triples to the web on a nice user-friendly content-rich website.

Latest attempt involves Drupal 6 and the Relations API module, as it seems to me that Drupal 7 doesn’t yet have this particular functionality (though I am hoping it will by code freeze!)

Anyway, thus my latest discovery: the installation instructions in the INSTALL.txt packaged with Drupal 6.17 are WRONG. They tell you to make a copy of default.settings.php to settings.php before you visit the new site the first time and choose your language. This will result in annoying error messages like so: “Warning: Table ‘mydb.access’ doesn’t exist query: SELECT 1 FROM access WHERE type = ‘host’ AND …”.

Luckily the solution is documented here:
http://drupal.org/node/464982

but would it be too much to ask to correct the INSTALL.txt file for us old-fashioned text-doc-reading types?

Cubicweb notes

So, although the RDF support in Drupal7 is really encouraging, I wanted to experiment with a pure semweb app that might make it cleaner and quicker to add relations between things. Trying out Cubicweb, here are some notes:

My main server runs Fedora, which is supported but doesn’t have a packaged install. Going down the path of least resistance, I spun up a cheap Debian Lenny server at Rackspace.com and installed the nice debian packages following the instructions at http://www.cubicweb.org/doc/en/admin/setup.html. All went well until I hit the ‘Next’ link and got to the page Creation of your first instance. Oops! I haven’t installed a cube yet, and here it says “Now that we created a cube…”. Back, forth, nope – didn’t miss a step, must be a wrong link in the docs.

Backed up and found the tutorial with Steps for creating your cube. Continuing…

learning python-isms, such as the fact that classes must start with capital letters…

and YES! It works. http://173.203.29.23:8080/ Its password protected so you can’t see anything public yet, but I love the interface that encourages you to add relations to everything.

sigh. Drupal7 thinks I only have SQLite (solved)

There seems to be a lot of excitement in the Drupal 7 dev groups about support for SQLite. Well and good, but when I try to install Drupal 7 on my Mysql/Apache/PHP5 server, I get “Your PHP configuration only supports the SQLite database type so it has been automatically selected.”. And unfortunately the section search capabilities on drupal.org are not good enough to make a quick existing bug search efficient.

Drupal 6 detects my Mysql server without any problem…

(I was trying to install Drupal 7 for the RDF capabilities, it seems RDFCCK will be part of core in 7. But looks like may have to wait a few months.)

A bit of research determined that Drupal 7 requires the PDO extension to PHP. However, something funky in my Fedora OS setup didn’t let me recompile PHP from scratch, and yum update php wasn’t doing the trick. Finally, after looking at this page

http://www.electrictoolbox.com/update-php-command-line-yum/

I tried just yum installing the extensions, like so:

1010 yum install php-pdo
1011 yum install php-mysql
1012 yum update php
1013 yum install php-gd
1014 yum install php-xml
1015 yum install php-soap

and that worked. Your mileage may vary…

Vocabulary reuse not well solved yet…but RDFCCK may just be a step

Some links relevent to vocab reuse/microformats. In particular RDF vocabs should be simple to import into all the modern CMS’s, but we’re not there yet.

esw.w3.org/VocabularyMarket

esw.w3.org/SeedApplications

Evoc drupal module for importing RDF vocabs and exposing properties in Drupal
RDFCCK drupal module by the same author, Stephane “scor” Corlosquet
article by Marco Neumann on importing semantics into Drupal

Import SKOS into Drupal taxonomy but then do you need to use the RDFa module to have your Drupal content part of the linked data initiative?
————-
Follow-up (If I post as a comment, not visible from front page – need to configure WP to do follow-up threads better):

Reading Scor’s paper, sounds like work is heading in the right direction. The autocompletion sounds promising

“To this end, our module adds a new tab “Manage RDF mappings” to the content
type administration panel of CCK for managing such mappings cf. Fig. 2. An autocomplete list of suggested terms is shown, based on the keyword entered by the user.

The terms are coming from two different sources, which are detailed below.

External vocabulary importer service

The module RDF external vocabulary importer…”

CubicWeb app framework

I like the looks of this – need to see if we can also have cubes that interface with mysql, make fuzzy-rule-based decisions as well as clear inferences. If so, this looks like a fun way to code…

mysqlimport bug coercing long floats

Just ran into an error, using mysqlimport to pull in a tab-delimited file with long float values in BIGINT columns. When trying to import the value

866.897575000000057458

as an int, mysqlimport turned it into 866897575000000057458 – a bit off!

mysqlimport Ver 3.5 Distrib 5.0.45, for redhat-linux-gnu (x86_64)
(maybe this is fixed in 5.1, don’t know)

The ultimate personal organizer…

Posted some thoughts on my personal blog at

http://goldavelez.com/blog/2009/10/30/the-ultimate-organizer-will-it-be-a-web-app/

about the ideal organizer (smart, quick, easy, fast, private, snappy…). As someone much smarter said a long time ago, using your computer should feel like playing the violin – assuming, that is, that you know how to play the violin. But it should come to feel natural, like an extension of the body and mind. For humans, this means millisecond level feedback.