Skip to content
WebOrganics edited this page Mar 18, 2012 · 33 revisions

TransFormr version 2.6

TransFormr is a simple toolkit that uses PHP and XSLT for extracting and transforming microformats

Microformats are : Designed for humans first and machines second, microformats are a set of simple, open data formats built upon existing and widely adopted standards.

Microformats make it easy for you or anyone to share and reuse data in your webpages and content elsewhere — for example, to populate an address book, browse social relationships, share reviews, tag content or publish and discover events.

See also Microformats Wiki Definition

Microformats that are supported by this transformer are:

Non microformats supported by this transformer are:

Installation

You must have PHP version 5.2.0 or higher with XSLT enabled to run TransFormr.

  • Download the latest version of Transformr from http://github.com/WebOrganics/TransFormr.
  • Unpack the entire contents of the file called WebOrganics-TransFormr-XXXXX to your webserver either into its own directory or the the root of your directory (dedicated transformers only).
  • Take a look at the settings in index.php and change to suit (everything should work fine without altering anything).
  • If you plan to use the ARC2 store, enter your database, user, pass and hosts settings in /app/config.php and check that the dump folder is writable by the webserver ( chmod 0755 ).
  • Surf your way to wherever you unpacked your file eg: http://example.com/transformr/ .
  • Enter a url, Have fun transforming some microformats ;)

Transformr Conversion urls

Types are :

Type Output Description
detect HTML Detects all microformats
hcard vcf A vCard file
hcard-rdf rdf1 hcard to vCal RDF
hcalendar ics an iCalendar file
hcalendar-rdf rdf1 hcalendar to vCal RDF
hatom xml hatom to atom
hatom-sioc rdf1 hAtom to SIOC
hatom-rss2 xml hatom + hMedia2 to RSS2
hreview rdf1 hreview to Review RDF
geo kml geo to KML
haudio-rss xml haudio to RSS2
haudio-xspf xspf haudio to XSPF
mo-haudio rdf1 haudio to Music Ontology
hfoaf rdf1 hCard + XFN2 to FOAF
hcard2qrcode png hCard to QRCode Image

Non Microformat Types are:

Type Output Description
rdfa rdf1 RDFa to RDFXML
erdf rdf1 eRDF to RDF
ogp-rdf rdf1 Open Graph Protocol to RDF
microdata json Microdata to JSON

1 Additional output conversions ntriples, rdfa, turtle, rdfjson, html (Microdata)

2 Optional Microformat.

Non RDF conversions,

  • index.php?type=(type)&url=http://(your page)

For all RDF conversions

  • index.php?type=(type)&output=(ntriples|rdfa|turtle|rdfjson|html)&url=http://(your page)

Apache Clean URLs

Non RDF conversions,

  • http://[transformr]/[type]/http://[your page] ( transforms a whole page )
  • http://[transformr]/[type]/referer ( transforms from referring url )
  • http://[transformr]/[type]/[your fragment] ( transforms from referring html id )

For all RDF conversions

  • http://[transformr]/[type]/(ntriples|rdfa|turtle|rdfjson|html)/http://[your page]

By JSON Query.

Queries are formed using three properties, url (url of the web-page ) , type ( conversion type ) and output (output type), example

  • index.php?q={ “url” : “http://somewebsite.com/”, “type” : “hcard-rdf”, “output” : “ntriples” }

The output property is optional and may be omitted from a Query, example

  • index.php?q={ “url” : “http://somewebsite.com/”, “type” : “hcard” }

By SPARQL Query

When you extract RDF using Transformr and the arc2 store is enabled, you can query the Transformr endpoint using sparql, example

  • /sparql/endpoint?query=CONSTRUCT { ?s ?p ?o .} WHERE { GRAPH </type/http://somewebpage.com/> { ?s ?p ?o . } }

All graphs are relative to the store, “type” is the type of RDF you extracted e.g hfoaf, rdfa … etc.

By Direct input.

You can also transform a fragment of html by direct input, this is intended to be used for testing you markup before publishing it live.

Future releases

Work is in progress supporting the Species Microformat, hProduct + hCard Microformat to Good Relations and Data vocab transformation for Rich Snippets.

Notes

  • 2.6 Added HTML5 Parser and parsing microdata by direct input.
  • 2.5 Added microdata to JSON transformation.
  • 2.4 Added value-title parsing for all microformats.
  • 2.3 Transformr is now Faster due to new caching action. Added support for Transforming by direct input, Some XSLT bugs fixed.
  • 2.2 Transform processes base@href for all xslt transformations, AR2 RDFTransformrPlugin and EndpointTemplatePlugin support around 350 namespaces, list is automatically downloaded from http://prefix.cc/, improved config.php .
  • 2.1 Endpoint has new template using ARC2_EndpointTemplatPlugin, and DELETE FROM <…> functionality.
  • 2.0 adds ARC2 storage and hAtom2SIOC transformation.
  • 1.3 fixes @prefix and @vocab support for RDFa plus one or two minor bugs.
  • 1.2 Implements JSON Query.
  • 1.1 some bugs fixed, new hcard 2 qrcode api
  • 1.0 New code, added some configurations, ogp-rdf transformation added, xoxo-opml transformation added, updated version of ARC2 2010-04-26
  • 0.6.2 updated ARC2_Transformr, includes a non-hacked version of ARC2.
  • 0.6.1 Most RDF including RDFa conversions are parsed by ARC2 ( included ) http://arc.semsol.org/
  • 0.5.1 Transformr also supports Fragment parsing for individual microformats.

Credits

Many thanks to:

  • Matthias Pfefferle ( microform.at )
  • Ben Ward ( X2V )
  • Benjamin Nowack ( ARC2 rdf parsing and translations )
  • Lin Clark (MicrodataPHP )
  • Fabien Gandon ( Facebook Open Graph Protocol, OGPGRDDL.xsl and RDFa2RDFXML.xsl)
  • Richard Cyganiak ( prefix.cc )