From: <her...@us...> - 2009-02-26 13:01:12
|
Revision: 1752 http://aperture.svn.sourceforge.net/aperture/?rev=1752&view=rev Author: herko_ter_horst Date: 2009-02-26 12:43:55 +0000 (Thu, 26 Feb 2009) Log Message: ----------- Mavenized addressbook modules. Updated vcard subcrawler dependencies. Modified Paths: -------------- aperture/trunk/core/addressbook/apple/pom.xml aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookCrawler.java aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDetector.java aperture/trunk/core/addressbook/thunderbird/pom.xml aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDetector.java aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdCrawler.java aperture/trunk/core/crawler/ical/pom.xml aperture/trunk/core/crawler/mbox/pom.xml aperture/trunk/core/crawler/pom.xml aperture/trunk/core/crawler/vcard/pom.xml aperture/trunk/core/crawler/vcard/src/main/java/org/semanticdesktop/aperture/subcrawler/vcard/VcardSubCrawler.java aperture/trunk/core/pom.xml aperture/trunk/pom.xml Added Paths: ----------- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/bundle/ aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/bundle/AppleAddressbookActivator.java aperture/trunk/core/addressbook/apple/src/main/resources/ aperture/trunk/core/addressbook/apple/src/main/resources/org/ aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/ aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/ aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/ aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/ aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/bundle/ aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/bundle/ThunderbirdAddressbookActivator.java aperture/trunk/core/addressbook/thunderbird/src/main/resources/ aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/ aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/semanticdesktop/ aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/semanticdesktop/aperture/ aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/semanticdesktop/aperture/addressbook/ aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/semanticdesktop/aperture/addressbook/thunderbird/ aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl Removed Paths: ------------- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/APPLEADDRESSBOOKDS.java aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.java aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/THUNDERBIRDADDRESSBOOKDS.java aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.java aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl Property Changed: ---------------- aperture/trunk/core/addressbook/apple/ aperture/trunk/core/addressbook/core/ aperture/trunk/core/addressbook/thunderbird/ Property changes on: aperture/trunk/core/addressbook/apple ___________________________________________________________________ Added: svn:ignore + .classpath .project .settings target Modified: aperture/trunk/core/addressbook/apple/pom.xml =================================================================== --- aperture/trunk/core/addressbook/apple/pom.xml 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/apple/pom.xml 2009-02-26 12:43:55 UTC (rev 1752) @@ -16,6 +16,15 @@ <name>Aperture Core: Addressbook - Apple</name> <description>Apple addressbook implementation</description> + <properties> + <ontology.input>src/main/resources/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl</ontology.input> + <ontology.namespace>http://aperture.semanticdesktop.org/ontology/2007/08/12/appleaddresbookds#</ontology.namespace> + <ontology.class>APPLEADDRESSBOOKDS</ontology.class> + <generator.output.package>org.semanticdesktop.aperture.addressbook.apple</generator.output.package> + <generator.output.class>AppleAddressbookDataSource</generator.output.class> + <generator.output.dir>src/main/java</generator.output.dir> + </properties> + <dependencies> <dependency> <groupId>org.semanticdesktop.aperture</groupId> @@ -31,6 +40,10 @@ </dependency> <dependency> <groupId>org.semanticdesktop.aperture</groupId> + <artifactId>aperture-detector-core</artifactId> + </dependency> + <dependency> + <groupId>org.semanticdesktop.aperture</groupId> <artifactId>aperture-rdf</artifactId> </dependency> <dependency> @@ -64,6 +77,60 @@ </dependency> </dependencies> + <build> + <plugins> + <plugin> + <groupId>org.semanticdesktop.aperture</groupId> + <artifactId>aperture-vocabulary-maven-plugin</artifactId> + <configuration> + <vocabularies> + <vocabulary> + <ontology>${ontology.input}</ontology> + <namespace>${ontology.namespace}</namespace> + <javaClass>${generator.output.package}.${ontology.class}</javaClass> + <outputDir>${generator.output.dir}</outputDir> + </vocabulary> + </vocabularies> + </configuration> + </plugin> + <plugin> + <groupId>org.semanticdesktop.aperture</groupId> + <artifactId>aperture-datasource-maven-plugin</artifactId> + <configuration> + <dataSources> + <dataSource> + <ontology>${ontology.input}</ontology> + <namespace>${ontology.namespace}</namespace> + <ontologyClass>${ontology.class}</ontologyClass> + <javaClass>${generator.output.package}.${generator.output.class}</javaClass> + <outputDir>${generator.output.dir}</outputDir> + </dataSource> + </dataSources> + </configuration> + </plugin> + <plugin> + <artifactId>maven-jar-plugin</artifactId> + <configuration> + <archive> + <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> + </archive> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <extensions>true</extensions> + <configuration> + <instructions> + <Export-Package>org.semanticdesktop.aperture.addressbook.apple</Export-Package> + <Private-Package>org.semanticdesktop.aperture.addressbook.apple.bundle</Private-Package> + <Bundle-Activator>org.semanticdesktop.aperture.addressbook.apple.bundle.AppleAddressbookActivator</Bundle-Activator> + </instructions> + </configuration> + </plugin> + </plugins> + </build> + <profiles> <profile> <id>on-mac</id> @@ -74,35 +141,11 @@ </activation> <dependencies> <dependency> - <groupId>org.semanticdesktop.aperture</groupId> + <groupId>org.semanticdesktop.nepomuk</groupId> <artifactId>aperture-tools-applewrapper</artifactId> <scope>runtime</scope> </dependency> </dependencies> - <build> - <plugins> - <plugin> - <artifactId>maven-jar-plugin</artifactId> - <configuration> - <archive> - <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> - </archive> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.felix</groupId> - <artifactId>maven-bundle-plugin</artifactId> - <extensions>true</extensions> - <configuration> - <instructions> - <Export-Package>org.semanticdesktop.aperture.addressbook.apple</Export-Package> - <Private-Package>org.semanticdesktop.aperture.addressbook.apple.bundle</Export-Package> - <Bundle-Activator>org.semanticdesktop.aperture.addressbook.apple.bundle.AppleAddressbookActivator</Bundle-Activator> - </instructions> - </configuration> - </plugin> - </plugins> - </build> </profile> <profile> <!-- Make sure the build doesn't fail when not on a Mac --> @@ -116,20 +159,6 @@ <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-compiler-plugin</artifactId> - <configuration> - <failOnError>false</failOnError> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-deploy-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - </plugin> - <plugin> - <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <configuration> <skip>true</skip> Deleted: aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/APPLEADDRESSBOOKDS.java =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/APPLEADDRESSBOOKDS.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/APPLEADDRESSBOOKDS.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006 - 2008 Aduna and Deutsches Forschungszentrum fuer Kuenstliche Intelligenz DFKI GmbH. - * All rights reserved. - * - * Licensed under the Aperture BSD-style license. - */ -package org.semanticdesktop.aperture.addressbook.apple; -import java.io.FileNotFoundException; -import java.io.InputStream; - -import org.ontoware.rdf2go.model.Model; -import org.ontoware.rdf2go.model.Syntax; -import org.ontoware.rdf2go.model.node.URI; -import org.ontoware.rdf2go.model.node.impl.URIImpl; -import org.semanticdesktop.aperture.util.ResourceUtil; -/** - * Vocabulary File. Created by org.semanticdesktop.aperture.util.VocabularyWriter on Tue Jul 15 22:55:55 CEST 2008 - * input file: D:\workspace\aperture/src/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl - * namespace: http://aperture.semanticdesktop.org/ontology/2007/08/12/appleaddresbookds# - */ -public class APPLEADDRESSBOOKDS { - - /** Path to the ontology resource */ - public static final String APPLEADDRESSBOOKDS_RESOURCE_PATH = - "org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl"; - - /** - * Puts the APPLEADDRESSBOOKDS ontology into the given model. - * @param model The model for the source ontology to be put into. - * @throws Exception if something goes wrong. - */ - public static void getAPPLEADDRESSBOOKDSOntology(Model model) { - try { - InputStream stream = ResourceUtil.getInputStream(APPLEADDRESSBOOKDS_RESOURCE_PATH, APPLEADDRESSBOOKDS.class); - if (stream == null) { - throw new FileNotFoundException("couldn't find resource " + APPLEADDRESSBOOKDS_RESOURCE_PATH); - } - model.readFrom(stream, Syntax.Turtle); - } catch(Exception e) { - throw new RuntimeException(e); - } - } - - /** The namespace for APPLEADDRESSBOOKDS */ - public static final URI NS_APPLEADDRESSBOOKDS = new URIImpl("http://aperture.semanticdesktop.org/ontology/2007/08/12/appleaddresbookds#"); - /** - * Type: Class <br/> - * Label: Apple Addresbook Data Source <br/> - * Comment: Describes an apple addresbook <br/> - */ - public static final URI AppleAddressbookDataSource = new URIImpl("http://aperture.semanticdesktop.org/ontology/2007/08/12/appleaddresbookds#AppleAddressbookDataSource"); -} Modified: aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookCrawler.java =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookCrawler.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookCrawler.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -27,8 +27,8 @@ import org.semanticdesktop.aperture.addressbook.AddressbookCrawler; import org.semanticdesktop.aperture.datasource.DataSource; import org.semanticdesktop.aperture.rdf.RDFContainer; +import org.semanticdesktop.aperture.rdf.util.ModelUtil; import org.semanticdesktop.aperture.util.FileUtil; -import org.semanticdesktop.aperture.util.ModelUtil; import org.semanticdesktop.aperture.vocabulary.NCO; import org.semanticdesktop.aperture.vocabulary.NIE; import org.slf4j.Logger; Deleted: aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.java =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2006 - 2008 Aduna and Deutsches Forschungszentrum fuer Kuenstliche Intelligenz DFKI GmbH. - * All rights reserved. - * - * Licensed under the Aperture BSD-style license. - */ -package org.semanticdesktop.aperture.addressbook.apple; -import org.ontoware.rdf2go.model.node.URI; -import org.semanticdesktop.aperture.datasource.DataSource; -import org.semanticdesktop.aperture.datasource.base.DataSourceBase; - -/** - * Data source class file. Created by org.semanticdesktop.aperture.util.DataSourceClassGenerator on Tue Jul 15 22:55:59 CEST 2008 - * input file: D:\workspace\aperture/src/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl - * class uri: http://aperture.semanticdesktop.org/ontology/2007/08/12/appleaddresbookds#AppleAddressbookDataSource - */ -public class AppleAddressbookDataSource extends DataSourceBase { - - /** - * @see DataSource#getType() - */ - public URI getType() { - return APPLEADDRESSBOOKDS.AppleAddressbookDataSource; - } -} Deleted: aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl 2009-02-26 12:43:55 UTC (rev 1752) @@ -1,18 +0,0 @@ -@prefix fresnel: <http://www.w3.org/2004/09/fresnel#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -@prefix sourceformat: <http://aperture.semanticdesktop.org/ontology/sourceformat#> . -@prefix source: <http://aperture.semanticdesktop.org/ontology/2007/08/12/source#> . -@prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> . -@prefix : <http://aperture.semanticdesktop.org/ontology/2007/08/12/appleaddresbookds#> . - -:AppleAddressbookDataSource a rdfs:Class ; - rdfs:subClassOf nie:DataSource ; - rdfs:label "Apple Addresbook Data Source" ; - rdfs:comment "Describes an apple addresbook" . - -:AppleDataSourceLens rdf:type fresnel:Lens ; - fresnel:purpose fresnel:defaultLens ; - fresnel:classLensDomain :AppleAddressbookDataSource ; - fresnel:showProperties ( ) . \ No newline at end of file Modified: aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDetector.java =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDetector.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDetector.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -16,8 +16,8 @@ import org.semanticdesktop.aperture.detector.DataSourceDescription; import org.semanticdesktop.aperture.detector.DataSourceDetector; import org.semanticdesktop.aperture.rdf.impl.RDFContainerImpl; +import org.semanticdesktop.aperture.rdf.util.ModelUtil; import org.semanticdesktop.aperture.util.OSUtils; -import org.semanticdesktop.aperture.util.UriUtil; /** * Detects the apple addressbook datasource. @@ -35,7 +35,7 @@ AppleAddressbookDataSource ds = new AppleAddressbookDataSource(); Model m=RDF2Go.getModelFactory().createModel(); m.open(); - ds.setConfiguration(new RDFContainerImpl(m, UriUtil.generateRandomURI(m))); + ds.setConfiguration(new RDFContainerImpl(m, ModelUtil.generateRandomURI(m))); ds.setName("Apple Addressbook"); ds.setComment("Your contacts from the Apple Addressbook"); ArrayList<DataSourceDescription> result = new ArrayList<DataSourceDescription>(1); Deleted: aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript 2009-02-26 12:43:55 UTC (rev 1752) @@ -1,123 +0,0 @@ --- Really crappy Aperture Crawler for the MacOSX Address Book --- This version by Gunnar Grimnes, standing on the shoulder of giants (well, midgets?) --- See http://gnowsis.opendfki.de/wiki/AppleAddressBookDatasource, which in turn has more references - --- Find/change routine from Apple's AppleScript Guidebook --- module "Essential sub-routines." -on replace_chars(this_text, search_string, replacement_string) - set AppleScript's text item delimiters to the search_string - set the item_list to every text item of this_text - set AppleScript's text item delimiters to the replacement_string - set this_text to the item_list as string - set AppleScript's text item delimiters to "" - return this_text -end replace_chars - - -on trim_line(this_text, trim_chars, trim_indicator) - -- 0 = beginning, 1 = end, 2 = both - set x to the length of the trim_chars - -- TRIM BEGINNING - if the trim_indicator is in {0, 2} then - repeat while this_text begins with the trim_chars - try - set this_text to characters (x + 1) thru -1 of this_text as string - on error - -- the text contains nothing but the trim characters - return "" - end try - end repeat - end if - -- TRIM ENDING - if the trim_indicator is in {1, 2} then - repeat while this_text ends with the trim_chars - try - set this_text to characters 1 thru -(x + 1) of this_text as string - on error - -- the text contains nothing but the trim characters - return "" - end try - end repeat - end if - return this_text -end trim_line - --- my own -on xmlescape(txt) - set txt to replace_chars(txt,"&","&") - set txt to replace_chars(txt,"<","<") - set txt to replace_chars(txt,">",">") - return txt -end myxmlescape - --- urlencode is from: --- http://harvey.nu/applescript_url_encode_routine.html --- This safely encodes text so it can be used in a URL -on urlencode(theText) - set theTextEnc to "" - repeat with eachChar in characters of theText - set useChar to eachChar - set eachCharNum to ASCII number of eachChar - if eachCharNum = 38 then - set useChar to "_" - else if eachCharNum = 32 then - set useChar to "+" - else if (eachCharNum < 42) and (eachCharNum > 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then - set firstDig to round (eachCharNum / 16) rounding down - set secondDig to eachCharNum mod 16 - if firstDig > 9 then - set aNum to firstDig + 55 - set firstDig to ASCII character aNum - end if - if secondDig > 9 then - set aNum to secondDig + 55 - set secondDig to ASCII character aNum - end if - set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string - set useChar to numHex - end if - set theTextEnc to theTextEnc & useChar as string - end repeat - return theTextEnc -end urlencode - -set quitonfinish to true -tell application "Finder" - if exists process "Address Book" then - set quitonfinish to false - end if -end tell - -tell application "Address Book" - set out to "<rdf:RDF xmlns:foaf='http://xmlns.com/foaf/0.1/' xmlns:nco='http://www.semanticdesktop.org/ontologies/2007/03/22/nco#' xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>" & return - repeat with p in people - set out to out & "<nco:Contact rdf:about='urn:mac:addressbook:" & my urlencode(name of p) & "'>" & return - set person_name to my xmlescape(name of p) - set out to out & " <nco:fullname>" & (person_name) & "</nco:fullname>" & return - set out to out & " <rdfs:label>" & (person_name) & "</rdfs:label>" & return - - repeat with e in emails of p - set em to my trim_line(my xmlescape(value of e)," ",2) - set out to out & " <nco:hasEmailAddress rdf:parseType='Resource'>" & return - set out to out & " <nco:emailAddress>" & em & "</nco:emailAddress>" & return - set out to out & " <rdf:type rdf:resource='http://www.semanticdesktop.org/ontologies/2007/03/22/nco#EmailAddress' />" & return - set out to out & " </nco:hasEmailAddress>" & return - end repeat - repeat with g in groups of p - set gt to my trim_line(my xmlescape(name of g), " ", 2) - set out to out & " <nco:belongsToGroup rdf:parseType='Resource'>" & gt & "</nco:belongsToGroup>" & return - set out to out & " <rdf:type rdf:resource='http://www.semanticdesktop.org/ontologies/2007/03/22/nco#ContactGroup' />" & return - set out to out & " <nco:contactGroupName>" & gt & "</nco:contactGroupName>" & return - set out to out & " </nco:belongsToGroup>" & return - end repeat - set out to out & "</nco:Contact>" & return - end repeat - set out to out & "</rdf:RDF>" - - if quitonfinish is true then - quit - end if - - return out - -end tell \ No newline at end of file Added: aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/bundle/AppleAddressbookActivator.java =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/bundle/AppleAddressbookActivator.java (rev 0) +++ aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/bundle/AppleAddressbookActivator.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2006 - 2008 Aduna and Deutsches Forschungszentrum fuer Kuenstliche Intelligenz DFKI GmbH. + * All rights reserved. + * + * Licensed under the Aperture BSD-style license. + */ +package org.semanticdesktop.aperture.addressbook.apple.bundle; + +import java.util.Hashtable; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.semanticdesktop.aperture.addressbook.apple.AppleAddressbookCrawlerFactory; +import org.semanticdesktop.aperture.addressbook.apple.AppleAddressbookDataSourceFactory; +import org.semanticdesktop.aperture.datasource.DataSourceFactory; + +public class AppleAddressbookActivator implements BundleActivator { + + private ServiceRegistration dataSourceRegistration; + + private ServiceRegistration crawlerRegistration; + + public void start(BundleContext context) throws Exception { + crawlerRegistration = context.registerService(DataSourceFactory.class + .getName(), new AppleAddressbookCrawlerFactory(), + new Hashtable()); + + crawlerRegistration = context.registerService(DataSourceFactory.class + .getName(), new AppleAddressbookDataSourceFactory(), + new Hashtable()); + + } + + public void stop(BundleContext context) throws Exception { + if (crawlerRegistration != null) { + crawlerRegistration.unregister(); + crawlerRegistration = null; + } + + if (dataSourceRegistration != null) { + dataSourceRegistration.unregister(); + dataSourceRegistration = null; + } + } +} Copied: aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl (from rev 1750, aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl) =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl (rev 0) +++ aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/AppleAddressbookDataSource.ttl 2009-02-26 12:43:55 UTC (rev 1752) @@ -0,0 +1,18 @@ +@prefix fresnel: <http://www.w3.org/2004/09/fresnel#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix sourceformat: <http://aperture.semanticdesktop.org/ontology/sourceformat#> . +@prefix source: <http://aperture.semanticdesktop.org/ontology/2007/08/12/source#> . +@prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> . +@prefix : <http://aperture.semanticdesktop.org/ontology/2007/08/12/appleaddresbookds#> . + +:AppleAddressbookDataSource a rdfs:Class ; + rdfs:subClassOf nie:DataSource ; + rdfs:label "Apple Addresbook Data Source" ; + rdfs:comment "Describes an apple addresbook" . + +:AppleDataSourceLens rdf:type fresnel:Lens ; + fresnel:purpose fresnel:defaultLens ; + fresnel:classLensDomain :AppleAddressbookDataSource ; + fresnel:showProperties ( ) . \ No newline at end of file Copied: aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript (from rev 1750, aperture/trunk/core/addressbook/apple/src/main/java/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript) =================================================================== --- aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript (rev 0) +++ aperture/trunk/core/addressbook/apple/src/main/resources/org/semanticdesktop/aperture/addressbook/apple/addressbook.applescript 2009-02-26 12:43:55 UTC (rev 1752) @@ -0,0 +1,123 @@ +-- Really crappy Aperture Crawler for the MacOSX Address Book +-- This version by Gunnar Grimnes, standing on the shoulder of giants (well, midgets?) +-- See http://gnowsis.opendfki.de/wiki/AppleAddressBookDatasource, which in turn has more references + +-- Find/change routine from Apple's AppleScript Guidebook +-- module "Essential sub-routines." +on replace_chars(this_text, search_string, replacement_string) + set AppleScript's text item delimiters to the search_string + set the item_list to every text item of this_text + set AppleScript's text item delimiters to the replacement_string + set this_text to the item_list as string + set AppleScript's text item delimiters to "" + return this_text +end replace_chars + + +on trim_line(this_text, trim_chars, trim_indicator) + -- 0 = beginning, 1 = end, 2 = both + set x to the length of the trim_chars + -- TRIM BEGINNING + if the trim_indicator is in {0, 2} then + repeat while this_text begins with the trim_chars + try + set this_text to characters (x + 1) thru -1 of this_text as string + on error + -- the text contains nothing but the trim characters + return "" + end try + end repeat + end if + -- TRIM ENDING + if the trim_indicator is in {1, 2} then + repeat while this_text ends with the trim_chars + try + set this_text to characters 1 thru -(x + 1) of this_text as string + on error + -- the text contains nothing but the trim characters + return "" + end try + end repeat + end if + return this_text +end trim_line + +-- my own +on xmlescape(txt) + set txt to replace_chars(txt,"&","&") + set txt to replace_chars(txt,"<","<") + set txt to replace_chars(txt,">",">") + return txt +end myxmlescape + +-- urlencode is from: +-- http://harvey.nu/applescript_url_encode_routine.html +-- This safely encodes text so it can be used in a URL +on urlencode(theText) + set theTextEnc to "" + repeat with eachChar in characters of theText + set useChar to eachChar + set eachCharNum to ASCII number of eachChar + if eachCharNum = 38 then + set useChar to "_" + else if eachCharNum = 32 then + set useChar to "+" + else if (eachCharNum < 42) and (eachCharNum > 95) and (eachCharNum < 45 or eachCharNum > 46) and (eachCharNum < 48 or eachCharNum > 57) and (eachCharNum < 65 or eachCharNum > 90) and (eachCharNum < 97 or eachCharNum > 122) then + set firstDig to round (eachCharNum / 16) rounding down + set secondDig to eachCharNum mod 16 + if firstDig > 9 then + set aNum to firstDig + 55 + set firstDig to ASCII character aNum + end if + if secondDig > 9 then + set aNum to secondDig + 55 + set secondDig to ASCII character aNum + end if + set numHex to ("%" & (firstDig as string) & (secondDig as string)) as string + set useChar to numHex + end if + set theTextEnc to theTextEnc & useChar as string + end repeat + return theTextEnc +end urlencode + +set quitonfinish to true +tell application "Finder" + if exists process "Address Book" then + set quitonfinish to false + end if +end tell + +tell application "Address Book" + set out to "<rdf:RDF xmlns:foaf='http://xmlns.com/foaf/0.1/' xmlns:nco='http://www.semanticdesktop.org/ontologies/2007/03/22/nco#' xmlns:rdfs='http://www.w3.org/2000/01/rdf-schema#' xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>" & return + repeat with p in people + set out to out & "<nco:Contact rdf:about='urn:mac:addressbook:" & my urlencode(name of p) & "'>" & return + set person_name to my xmlescape(name of p) + set out to out & " <nco:fullname>" & (person_name) & "</nco:fullname>" & return + set out to out & " <rdfs:label>" & (person_name) & "</rdfs:label>" & return + + repeat with e in emails of p + set em to my trim_line(my xmlescape(value of e)," ",2) + set out to out & " <nco:hasEmailAddress rdf:parseType='Resource'>" & return + set out to out & " <nco:emailAddress>" & em & "</nco:emailAddress>" & return + set out to out & " <rdf:type rdf:resource='http://www.semanticdesktop.org/ontologies/2007/03/22/nco#EmailAddress' />" & return + set out to out & " </nco:hasEmailAddress>" & return + end repeat + repeat with g in groups of p + set gt to my trim_line(my xmlescape(name of g), " ", 2) + set out to out & " <nco:belongsToGroup rdf:parseType='Resource'>" & gt & "</nco:belongsToGroup>" & return + set out to out & " <rdf:type rdf:resource='http://www.semanticdesktop.org/ontologies/2007/03/22/nco#ContactGroup' />" & return + set out to out & " <nco:contactGroupName>" & gt & "</nco:contactGroupName>" & return + set out to out & " </nco:belongsToGroup>" & return + end repeat + set out to out & "</nco:Contact>" & return + end repeat + set out to out & "</rdf:RDF>" + + if quitonfinish is true then + quit + end if + + return out + +end tell \ No newline at end of file Property changes on: aperture/trunk/core/addressbook/core ___________________________________________________________________ Added: svn:ignore + .classpath .project .settings target Property changes on: aperture/trunk/core/addressbook/thunderbird ___________________________________________________________________ Added: svn:ignore + .classpath .project .settings target Modified: aperture/trunk/core/addressbook/thunderbird/pom.xml =================================================================== --- aperture/trunk/core/addressbook/thunderbird/pom.xml 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/thunderbird/pom.xml 2009-02-26 12:43:55 UTC (rev 1752) @@ -16,6 +16,15 @@ <name>Aperture Core: Addressbook - Thunderbird</name> <description>Thunderbird addressbook implementation</description> + <properties> + <ontology.input>src/main/resources/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl</ontology.input> + <ontology.namespace>http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds#</ontology.namespace> + <ontology.class>THUNDERBIRDADDRESSBOOKDS</ontology.class> + <generator.output.package>org.semanticdesktop.aperture.addressbook.thunderbird</generator.output.package> + <generator.output.class>ThunderbirdAddressbookDataSource</generator.output.class> + <generator.output.dir>src/main/java</generator.output.dir> + </properties> + <dependencies> <dependency> <groupId>org.semanticdesktop.aperture</groupId> @@ -31,6 +40,10 @@ </dependency> <dependency> <groupId>org.semanticdesktop.aperture</groupId> + <artifactId>aperture-detector-core</artifactId> + </dependency> + <dependency> + <groupId>org.semanticdesktop.aperture</groupId> <artifactId>aperture-rdf</artifactId> </dependency> <dependency> @@ -39,6 +52,11 @@ </dependency> <dependency> + <groupId>org.semanticdesktop.nepomuk</groupId> + <artifactId>aperture-tools-demork</artifactId> + </dependency> + + <dependency> <groupId>org.semweb4j</groupId> <artifactId>rdf2go.api</artifactId> </dependency> @@ -67,6 +85,35 @@ <build> <plugins> <plugin> + <groupId>org.semanticdesktop.aperture</groupId> + <artifactId>aperture-vocabulary-maven-plugin</artifactId> + <configuration> + <vocabularies> + <vocabulary> + <ontology>${ontology.input}</ontology> + <namespace>${ontology.namespace}</namespace> + <javaClass>${generator.output.package}.${ontology.class}</javaClass> + <outputDir>${generator.output.dir}</outputDir> + </vocabulary> + </vocabularies> + </configuration> + </plugin> + <plugin> + <groupId>org.semanticdesktop.aperture</groupId> + <artifactId>aperture-datasource-maven-plugin</artifactId> + <configuration> + <dataSources> + <dataSource> + <ontology>${ontology.input}</ontology> + <namespace>${ontology.namespace}</namespace> + <ontologyClass>${ontology.class}</ontologyClass> + <javaClass>${generator.output.package}.${generator.output.class}</javaClass> + <outputDir>${generator.output.dir}</outputDir> + </dataSource> + </dataSources> + </configuration> + </plugin> + <plugin> <artifactId>maven-jar-plugin</artifactId> <configuration> <archive> @@ -81,7 +128,7 @@ <configuration> <instructions> <Export-Package>org.semanticdesktop.aperture.addressbook.thunderbird</Export-Package> - <Private-Package>org.semanticdesktop.aperture.addressbook.thunderbird.bundle</Export-Package> + <Private-Package>org.semanticdesktop.aperture.addressbook.thunderbird.bundle</Private-Package> <Bundle-Activator>org.semanticdesktop.aperture.addressbook.thunderbird.bundle.ThunderbirdAddressbookActivator</Bundle-Activator> </instructions> </configuration> Deleted: aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/THUNDERBIRDADDRESSBOOKDS.java =================================================================== --- aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/THUNDERBIRDADDRESSBOOKDS.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/THUNDERBIRDADDRESSBOOKDS.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2006 - 2008 Aduna and Deutsches Forschungszentrum fuer Kuenstliche Intelligenz DFKI GmbH. - * All rights reserved. - * - * Licensed under the Aperture BSD-style license. - */ -package org.semanticdesktop.aperture.addressbook.thunderbird; -import java.io.FileNotFoundException; -import java.io.InputStream; - -import org.ontoware.rdf2go.model.Model; -import org.ontoware.rdf2go.model.Syntax; -import org.ontoware.rdf2go.model.node.URI; -import org.ontoware.rdf2go.model.node.impl.URIImpl; -import org.semanticdesktop.aperture.util.ResourceUtil; -/** - * Vocabulary File. Created by org.semanticdesktop.aperture.util.VocabularyWriter on Tue Jul 15 22:56:02 CEST 2008 - * input file: D:\workspace\aperture/src/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl - * namespace: http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds# - */ -public class THUNDERBIRDADDRESSBOOKDS { - - /** Path to the ontology resource */ - public static final String THUNDERBIRDADDRESSBOOKDS_RESOURCE_PATH = - "org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl"; - - /** - * Puts the THUNDERBIRDADDRESSBOOKDS ontology into the given model. - * @param model The model for the source ontology to be put into. - * @throws Exception if something goes wrong. - */ - public static void getTHUNDERBIRDADDRESSBOOKDSOntology(Model model) { - try { - InputStream stream = ResourceUtil.getInputStream(THUNDERBIRDADDRESSBOOKDS_RESOURCE_PATH, THUNDERBIRDADDRESSBOOKDS.class); - if (stream == null) { - throw new FileNotFoundException("couldn't find resource " + THUNDERBIRDADDRESSBOOKDS_RESOURCE_PATH); - } - model.readFrom(stream, Syntax.Turtle); - } catch(Exception e) { - throw new RuntimeException(e); - } - } - - /** The namespace for THUNDERBIRDADDRESSBOOKDS */ - public static final URI NS_THUNDERBIRDADDRESSBOOKDS = new URIImpl("http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds#"); - /** - * Type: Class <br/> - * Label: Thunderbird Addresbook Data Source <br/> - * Comment: Describes an addresbook maintained by Mozilla Thunderbird <br/> - */ - public static final URI ThunderbirdAddressbookDataSource = new URIImpl("http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds#ThunderbirdAddressbookDataSource"); - /** - * Type: Instance of http://www.w3.org/2004/09/fresnel#Format <br/> - * Label: Addresbook Path <br/> - * Comment: Path to the file where the addresbook is stored. <br/> - * Domain: http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds#ThunderbirdAddressbookDataSource <br/> - * Range: http://www.w3.org/2001/XMLSchema#string <br/> - */ - public static final URI thunderbirdAddressbookPath = new URIImpl("http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds#thunderbirdAddressbookPath"); -} Deleted: aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.java =================================================================== --- aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -1,52 +0,0 @@ -/* - * Copyright (c) 2006 - 2008 Aduna and Deutsches Forschungszentrum fuer Kuenstliche Intelligenz DFKI GmbH. - * All rights reserved. - * - * Licensed under the Aperture BSD-style license. - */ -package org.semanticdesktop.aperture.addressbook.thunderbird; -import org.ontoware.rdf2go.model.node.URI; -import org.semanticdesktop.aperture.datasource.DataSource; -import org.semanticdesktop.aperture.datasource.base.DataSourceBase; -import org.semanticdesktop.aperture.rdf.RDFContainer; - -/** - * Data source class file. Created by org.semanticdesktop.aperture.util.DataSourceClassGenerator on Tue Jul 15 22:56:06 CEST 2008 - * input file: D:\workspace\aperture/src/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl - * class uri: http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds#ThunderbirdAddressbookDataSource - */ -public class ThunderbirdAddressbookDataSource extends DataSourceBase { - - /** - * @see DataSource#getType() - */ - public URI getType() { - return THUNDERBIRDADDRESSBOOKDS.ThunderbirdAddressbookDataSource; - } - - /** - * Returns the Path to the file where the addresbook is stored. - * - * @return the Path to the file where the addresbook is stored. or null if no value has been set - * @throws NullPointerException if no configuration has been set, use - * {@link #setConfiguration(RDFContainer)} before calling this method - */ - public String getThunderbirdAddressbookPath() { - return getConfiguration().getString(THUNDERBIRDADDRESSBOOKDS.thunderbirdAddressbookPath); - } - - /** - * Sets the Path to the file where the addresbook is stored. - * - * @param thunderbirdAddressbookPath Path to the file where the addresbook is stored., can be null in which case any previous setting will be removed - * @throws NullPointerException if no configuration has been set, use - * {@link #setConfiguration(RDFContainer)} before calling this method - */ - public void setThunderbirdAddressbookPath(String thunderbirdAddressbookPath) { - if ( thunderbirdAddressbookPath == null) { - getConfiguration().remove(THUNDERBIRDADDRESSBOOKDS.thunderbirdAddressbookPath); - } else { - getConfiguration().put(THUNDERBIRDADDRESSBOOKDS.thunderbirdAddressbookPath,thunderbirdAddressbookPath); - } - } -} Deleted: aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl =================================================================== --- aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl 2009-02-26 12:43:55 UTC (rev 1752) @@ -1,30 +0,0 @@ -@prefix fresnel: <http://www.w3.org/2004/09/fresnel#> . -@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . -@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . -@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . -@prefix sourceformat: <http://aperture.semanticdesktop.org/ontology/sourceformat#> . -@prefix source: <http://aperture.semanticdesktop.org/ontology/2007/08/12/source#> . -@prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> . -@prefix : <http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds#> . - -:ThunderbirdAddressbookDataSource a rdfs:Class ; - rdfs:subClassOf nie:DataSource ; - rdfs:label "Thunderbird Addresbook Data Source" ; - rdfs:comment "Describes an addresbook maintained by Mozilla Thunderbird" . - -:ThunderbirdDataSourceLens rdf:type fresnel:Lens ; - fresnel:purpose fresnel:defaultLens ; - fresnel:classLensDomain :ThunderbirdAddressbookDataSource ; - fresnel:showProperties ( :thunderbirdAddressbookPath ) . - -:thunderbirdAddressbookPath a rdf:Property ; - rdfs:label "Addresbook Path" ; - rdfs:comment "Path to the file where the addresbook is stored." ; - rdfs:domain :ThunderbirdAddressbookDataSource ; - rdfs:range xsd:string . - -:thunderbirdAddressbookPath a fresnel:Format ; - sourceformat:valueWidget [ - a sourceformat:TextFieldWidget - ] ; - fresnel:propertyFormatDomain :thunderbirdAddressbookPath . Modified: aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDetector.java =================================================================== --- aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDetector.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDetector.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -21,9 +21,9 @@ import org.semanticdesktop.aperture.detector.DataSourceDescription; import org.semanticdesktop.aperture.detector.DataSourceDetector; import org.semanticdesktop.aperture.rdf.impl.RDFContainerImpl; +import org.semanticdesktop.aperture.rdf.util.ModelUtil; import org.semanticdesktop.aperture.util.OSUtils; import org.semanticdesktop.aperture.util.RegistryReader; -import org.semanticdesktop.aperture.util.UriUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -184,7 +184,7 @@ ThunderbirdAddressbookDataSource ds = new ThunderbirdAddressbookDataSource(); Model m=RDF2Go.getModelFactory().createModel(); m.open(); - ds.setConfiguration(new RDFContainerImpl(m, UriUtil.generateRandomURI(m))); + ds.setConfiguration(new RDFContainerImpl(m, ModelUtil.generateRandomURI(m))); ds.setName("Thunderbird Addressbook"); ds.setComment("Contacts from your Thunderbird Addressbook."); ds.setThunderbirdAddressbookPath(thunderbird.getAbsolutePath()+File.separator+defaultProfile+File.separator+"abook.mab"); Modified: aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdCrawler.java =================================================================== --- aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdCrawler.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdCrawler.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -27,7 +27,7 @@ import org.semanticdesktop.aperture.addressbook.AddressbookCrawler; import org.semanticdesktop.aperture.datasource.DataSource; import org.semanticdesktop.aperture.rdf.RDFContainer; -import org.semanticdesktop.aperture.util.UriUtil; +import org.semanticdesktop.aperture.rdf.util.ModelUtil; import org.semanticdesktop.aperture.vocabulary.NCO; import org.semanticdesktop.demork.Demork; import org.semanticdesktop.demork.Utils; @@ -130,8 +130,8 @@ private void addAffiliation(Resource contactResource, Model model) { if (affiliationResource == null && organizationResource == null) { - affiliationResource = UriUtil.generateRandomResource(model); - organizationResource = UriUtil.generateRandomResource(model); + affiliationResource = ModelUtil.generateRandomResource(model); + organizationResource = ModelUtil.generateRandomResource(model); model.addStatement(affiliationResource,RDF.type,NCO.Affiliation); model.addStatement(organizationResource,RDF.type,NCO.OrganizationContact); model.addStatement(contactResource,NCO.hasAffiliation,affiliationResource); @@ -170,7 +170,7 @@ try { if (key.equals("PrimaryEmail")) { // TODO: Which email? - Resource emailResource = UriUtil.generateRandomResource(model); + Resource emailResource = ModelUtil.generateRandomResource(model); model.addStatement(emailResource, RDF.type, NCO.EmailAddress); model.addStatement(emailResource, NCO.emailAddress, value); // TODO get back to it when hasPreferredContactMedium is introduced @@ -178,7 +178,7 @@ } else if (key.equals("SecondEmail")) { // TODO: Which email? - Resource emailResource = UriUtil.generateRandomResource(model); + Resource emailResource = ModelUtil.generateRandomResource(model); model.addStatement(emailResource, RDF.type, NCO.EmailAddress); model.addStatement(emailResource, NCO.emailAddress, value); // TODO get back to it when hasPreferredContactMedium is introduced @@ -230,7 +230,7 @@ model.addStatement(organizationResource,NCO.fullname,value); } else if (key.equals("_AimScreenName")) { - Resource aimResource = UriUtil.generateRandomResource(model); + Resource aimResource = ModelUtil.generateRandomResource(model); model.addStatement(aimResource,RDF.type,NCO.IMAccount); model.addStatement(aimResource,NCO.imAccountType,"AIM"); model.addStatement(aimResource,NCO.imNickname,value); @@ -274,7 +274,7 @@ } private void addEmailAddress(Resource contactResource, Model model, String value, URI type, String comment) { - Resource emailAddressResource = UriUtil.generateRandomResource(model); + Resource emailAddressResource = ModelUtil.generateRandomResource(model); if (type == null) { model.addStatement(emailAddressResource,RDF.type,NCO.EmailAddress); } else { @@ -288,7 +288,7 @@ } private void addPhoneNumber(Resource contactResource, Model model, String value, URI type) { - Resource numberResource = UriUtil.generateRandomResource(model); + Resource numberResource = ModelUtil.generateRandomResource(model); if (type == null) { model.addStatement(numberResource,RDF.type,NCO.PhoneNumber); } else { Added: aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/bundle/ThunderbirdAddressbookActivator.java =================================================================== --- aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/bundle/ThunderbirdAddressbookActivator.java (rev 0) +++ aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/bundle/ThunderbirdAddressbookActivator.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -0,0 +1,46 @@ +/* + * Copyright (c) 2006 - 2008 Aduna and Deutsches Forschungszentrum fuer Kuenstliche Intelligenz DFKI GmbH. + * All rights reserved. + * + * Licensed under the Aperture BSD-style license. + */ +package org.semanticdesktop.aperture.addressbook.thunderbird.bundle; + +import java.util.Hashtable; + +import org.osgi.framework.BundleActivator; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; +import org.semanticdesktop.aperture.addressbook.thunderbird.ThunderbirdAddressbookCrawlerFactory; +import org.semanticdesktop.aperture.addressbook.thunderbird.ThunderbirdAddressbookDataSourceFactory; +import org.semanticdesktop.aperture.datasource.DataSourceFactory; + +public class ThunderbirdAddressbookActivator implements BundleActivator { + + private ServiceRegistration dataSourceRegistration; + + private ServiceRegistration crawlerRegistration; + + public void start(BundleContext context) throws Exception { + crawlerRegistration = context.registerService(DataSourceFactory.class + .getName(), new ThunderbirdAddressbookCrawlerFactory(), + new Hashtable()); + + crawlerRegistration = context.registerService(DataSourceFactory.class + .getName(), new ThunderbirdAddressbookDataSourceFactory(), + new Hashtable()); + + } + + public void stop(BundleContext context) throws Exception { + if (crawlerRegistration != null) { + crawlerRegistration.unregister(); + crawlerRegistration = null; + } + + if (dataSourceRegistration != null) { + dataSourceRegistration.unregister(); + dataSourceRegistration = null; + } + } +} Copied: aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl (from rev 1750, aperture/trunk/core/addressbook/thunderbird/src/main/java/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl) =================================================================== --- aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl (rev 0) +++ aperture/trunk/core/addressbook/thunderbird/src/main/resources/org/semanticdesktop/aperture/addressbook/thunderbird/ThunderbirdAddressbookDataSource.ttl 2009-02-26 12:43:55 UTC (rev 1752) @@ -0,0 +1,30 @@ +@prefix fresnel: <http://www.w3.org/2004/09/fresnel#> . +@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> . +@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> . +@prefix xsd: <http://www.w3.org/2001/XMLSchema#> . +@prefix sourceformat: <http://aperture.semanticdesktop.org/ontology/sourceformat#> . +@prefix source: <http://aperture.semanticdesktop.org/ontology/2007/08/12/source#> . +@prefix nie: <http://www.semanticdesktop.org/ontologies/2007/01/19/nie#> . +@prefix : <http://aperture.semanticdesktop.org/ontology/2007/08/12/thunderbirdaddresbookds#> . + +:ThunderbirdAddressbookDataSource a rdfs:Class ; + rdfs:subClassOf nie:DataSource ; + rdfs:label "Thunderbird Addresbook Data Source" ; + rdfs:comment "Describes an addresbook maintained by Mozilla Thunderbird" . + +:ThunderbirdDataSourceLens rdf:type fresnel:Lens ; + fresnel:purpose fresnel:defaultLens ; + fresnel:classLensDomain :ThunderbirdAddressbookDataSource ; + fresnel:showProperties ( :thunderbirdAddressbookPath ) . + +:thunderbirdAddressbookPath a rdf:Property ; + rdfs:label "Addresbook Path" ; + rdfs:comment "Path to the file where the addresbook is stored." ; + rdfs:domain :ThunderbirdAddressbookDataSource ; + rdfs:range xsd:string . + +:thunderbirdAddressbookPath a fresnel:Format ; + sourceformat:valueWidget [ + a sourceformat:TextFieldWidget + ] ; + fresnel:propertyFormatDomain :thunderbirdAddressbookPath . Modified: aperture/trunk/core/crawler/ical/pom.xml =================================================================== --- aperture/trunk/core/crawler/ical/pom.xml 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/crawler/ical/pom.xml 2009-02-26 12:43:55 UTC (rev 1752) @@ -39,7 +39,7 @@ </dependency> <dependency> - <groupId>ical4j</groupId> + <groupId>net.fortuna.ical4j</groupId> <artifactId>ical4j</artifactId> </dependency> Modified: aperture/trunk/core/crawler/mbox/pom.xml =================================================================== --- aperture/trunk/core/crawler/mbox/pom.xml 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/crawler/mbox/pom.xml 2009-02-26 12:43:55 UTC (rev 1752) @@ -43,7 +43,7 @@ </dependency> <dependency> - <groupId>mstor</groupId> + <groupId>net.fortuna.mstor</groupId> <artifactId>mstor</artifactId> </dependency> Modified: aperture/trunk/core/crawler/pom.xml =================================================================== --- aperture/trunk/core/crawler/pom.xml 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/crawler/pom.xml 2009-02-26 12:43:55 UTC (rev 1752) @@ -26,7 +26,7 @@ <module>mail</module> <module>mime</module> <module>mbox</module> -<!-- <module>vcard</module> --> + <module>vcard</module> <module>web</module> </modules> </project> \ No newline at end of file Modified: aperture/trunk/core/crawler/vcard/pom.xml =================================================================== --- aperture/trunk/core/crawler/vcard/pom.xml 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/crawler/vcard/pom.xml 2009-02-26 12:43:55 UTC (rev 1752) @@ -19,6 +19,10 @@ <dependencies> <dependency> <groupId>org.semanticdesktop.aperture</groupId> + <artifactId>aperture-accessor-core</artifactId> + </dependency> + <dependency> + <groupId>org.semanticdesktop.aperture</groupId> <artifactId>aperture-crawler-core</artifactId> </dependency> <dependency> @@ -31,6 +35,16 @@ </dependency> <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + </dependency> + + <dependency> + <groupId>net.fortuna.ical4j</groupId> + <artifactId>ical4j-vcard</artifactId> + </dependency> + + <dependency> <groupId>org.semweb4j</groupId> <artifactId>rdf2go.api</artifactId> </dependency> Modified: aperture/trunk/core/crawler/vcard/src/main/java/org/semanticdesktop/aperture/subcrawler/vcard/VcardSubCrawler.java =================================================================== --- aperture/trunk/core/crawler/vcard/src/main/java/org/semanticdesktop/aperture/subcrawler/vcard/VcardSubCrawler.java 2009-02-26 12:42:56 UTC (rev 1751) +++ aperture/trunk/core/crawler/vcard/src/main/java/org/semanticdesktop/aperture/subcrawler/vcard/VcardSubCrawler.java 2009-02-26 12:43:55 UTC (rev 1752) @@ -7,28 +7,41 @@ package org.semanticdesktop.aperture.subcrawler.vcard; import java.io.ByteArrayOutputStream; +import java.io.IOException; import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; import java.nio.charset.Charset; -import java.text.ParseException; import java.util.Date; +import java.util.List; -import net.wimpi.pim.Pim; -import net.wimpi.pim.contact.io.ContactMarshaller; -import net.wimpi.pim.contact.io.ContactUnmarshaller; -import net.wimpi.pim.contact.model.Address; -import net.wimpi.pim.contact.model.Communications; -import net.wimpi.pim.contact.model.Contact; -import net.wimpi.pim.contact.model.EmailAddress; -import net.wimpi.pim.contact.model.GeographicalInformation; -import net.wimpi.pim.contact.model.Image; -import net... [truncated message content] |