com.googlecode.fascinator.transformer.aperture
Class ApertureTransformer

java.lang.Object
  extended by com.googlecode.fascinator.transformer.aperture.ApertureTransformer
All Implemented Interfaces:
Plugin, Transformer

public class ApertureTransformer
extends Object
implements Transformer

In this plugin Aperture Framework is utilised to extract RDF metadata and full-text from the DigitalObject.

Configuration

Option Description Required Default
id Transformer Id Yes aperture
outputPath Path where the aperture will store the temporary files Yes ${java.io.tmpdir}/${user.name}/ice2-output

Examples

  1. Aperture transformer with "${java.io.tmpdir}/${user.name}/ice2-output" specified as the outputPath
     "aperture": {
         "id": "aperture",
         "outputPath": "${java.io.tmpdir}/${user.name}/ice2-output"
     }
     

Wiki Link

https://fascinator.usq.edu.au/trac/wiki/Fascinator/Documents/Plugins/ Transformer/Aperture

Presently, only local files are accessible.

Author:
Duncan Dickinson, Linda Octalina
See Also:
Aperture Extractors Tutorial, NEPOMUK Information Element Ontology

Constructor Summary
ApertureTransformer()
          Extractor Constructor
 
Method Summary
static org.semanticdesktop.aperture.rdf.RDFContainer extractRDF(File file, String sourceId)
          Extracts RDF from the given File object.
static org.semanticdesktop.aperture.rdf.RDFContainer extractRDF(File file, String mimeType, String sourceId)
          Extracts RDF from the given File object, using the provided MIME Type rather than trying to work it out
static org.semanticdesktop.aperture.rdf.RDFContainer extractRDF(String file, String sourceId)
          Extracts RDF from a file denoted by a String-based descriptor (ie path)
static File getFile(String file)
          Utility function to resolve file:// URL's to a Java File object.
 String getId()
          Overridden method getId
 String getName()
          Overridden method getName
 PluginDescription getPluginDetails()
          Gets a PluginDescription object relating to this plugin.
 void init(File jsonFile)
          Overridden method init to initialize Configuration sample: "transformer": { "conveyer": "aperture-extractor, ice-transformer", "extractor": { "outputPath" : "${user.home}/ice2-output" }, "ice-transformer": { "url": "http://ice-service.usq.edu.au/api/convert/", "outputPath": "${user.home}/ice2-output" } }
 void init(String jsonString)
          Overridden method init to initialize Configuration sample: "transformer": { "conveyer": "aperture-extractor, ice-transformer", "extractor": { "outputPath" : "${user.home}/ice2-output" }, "ice-transformer": { "url": "http://ice-service.usq.edu.au/api/convert/", "outputPath": "${user.home}/ice2-output" } }
static void main(String[] args)
          Testing interface.
 void shutdown()
          Overridden method shutdown method
 String stripNonValidXMLCharacters(org.semanticdesktop.aperture.rdf.RDFContainer rdf)
           
 DigitalObject transform(DigitalObject in, String jsonConfig)
          Overridden transform method
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ApertureTransformer

public ApertureTransformer()
Extractor Constructor

Method Detail

main

public static void main(String[] args)
Testing interface. Takes a file name as either a local file path (e.g. /tmp/me.txt or c:\tmp\me.txt) or an file:// URL (e.g. file:///tmp/me.txt) and returns an RDF/XML representation of the metadata and full-text to standard out. Note: For large files (esp PDF) this can take a while

Parameters:
args - The file you wish to process

init

public void init(String jsonString)
          throws PluginException
Overridden method init to initialize Configuration sample: "transformer": { "conveyer": "aperture-extractor, ice-transformer", "extractor": { "outputPath" : "${user.home}/ice2-output" }, "ice-transformer": { "url": "http://ice-service.usq.edu.au/api/convert/", "outputPath": "${user.home}/ice2-output" } }

Specified by:
init in interface Plugin
Parameters:
jsonString - of configuration for Extractor
Throws:
PluginException - if fail to parse the config

init

public void init(File jsonFile)
          throws PluginException
Overridden method init to initialize Configuration sample: "transformer": { "conveyer": "aperture-extractor, ice-transformer", "extractor": { "outputPath" : "${user.home}/ice2-output" }, "ice-transformer": { "url": "http://ice-service.usq.edu.au/api/convert/", "outputPath": "${user.home}/ice2-output" } }

Specified by:
init in interface Plugin
Parameters:
jsonFile - to retrieve the configuration for Extractor
Throws:
PluginException - if fail to read the config file

extractRDF

public static org.semanticdesktop.aperture.rdf.RDFContainer extractRDF(String file,
                                                                       String sourceId)
                                                                throws IOException,
                                                                       org.semanticdesktop.aperture.extractor.ExtractorException,
                                                                       URISyntaxException
Extracts RDF from a file denoted by a String-based descriptor (ie path)

Parameters:
file - The file to be extracted
Returns:
An RDFContainer holding the extracted RDF
Throws:
IOException
org.semanticdesktop.aperture.extractor.ExtractorException
URISyntaxException

getFile

public static File getFile(String file)
                    throws URISyntaxException
Utility function to resolve file:// URL's to a Java File object. If passed a local file path this function just puts it into a file object. The following file paths (should) work:

Parameters:
file -
Returns:
A File object
Throws:
URISyntaxException

extractRDF

public static org.semanticdesktop.aperture.rdf.RDFContainer extractRDF(File file,
                                                                       String sourceId)
                                                                throws IOException,
                                                                       org.semanticdesktop.aperture.extractor.ExtractorException
Extracts RDF from the given File object. This function will handle MIME-type identification using Aperture.

Parameters:
file -
Returns:
Throws:
IOException
org.semanticdesktop.aperture.extractor.ExtractorException
See Also:
Aperture MIME Type Identification Tutorial

extractRDF

public static org.semanticdesktop.aperture.rdf.RDFContainer extractRDF(File file,
                                                                       String mimeType,
                                                                       String sourceId)
                                                                throws IOException,
                                                                       org.semanticdesktop.aperture.extractor.ExtractorException
Extracts RDF from the given File object, using the provided MIME Type rather than trying to work it out

Parameters:
file -
mimeType -
Returns:
Throws:
IOException
org.semanticdesktop.aperture.extractor.ExtractorException

getId

public String getId()
Overridden method getId

Specified by:
getId in interface Plugin
Returns:
plugin id

getName

public String getName()
Overridden method getName

Specified by:
getName in interface Plugin
Returns:
plugin name

getPluginDetails

public PluginDescription getPluginDetails()
Gets a PluginDescription object relating to this plugin.

Specified by:
getPluginDetails in interface Plugin
Returns:
a PluginDescription

shutdown

public void shutdown()
              throws PluginException
Overridden method shutdown method

Specified by:
shutdown in interface Plugin
Throws:
PluginException

transform

public DigitalObject transform(DigitalObject in,
                               String jsonConfig)
                        throws TransformerException
Overridden transform method

Specified by:
transform in interface Transformer
Parameters:
DigitalObject - to be processed
Returns:
processed DigitalObject with the rdf metadata
Throws:
TransformerException

stripNonValidXMLCharacters

public String stripNonValidXMLCharacters(org.semanticdesktop.aperture.rdf.RDFContainer rdf)


Copyright © 2009-2011. All Rights Reserved.