SlideShare uma empresa Scribd logo
1 de 20
Saveface – Save Facebook’s data
         as RDF graph
   Using Jena, Joseki & FB graph API
             Fuming Shih
           fuming@mit.edu
About Me
• 4th year graduate student at CSAIL, working
  with Hal Abelson
• Member of DIG group (decentralized
  information group) at CSAIL
• Working on topics relating to privacy, mobile
  context, and accountability



                                                  2
Saveflickr




Saveface




       Simond Secono's Walled Gardens Picture, taken from TimBL's presentation        3
Outline
•   Demo Saveface SPARQL endpoint
•   Overview
•   Set up Joseki SPARQL endpoint
•   From Protégé (data modeling) to Jena/Jaster
    (RDF library/SPARQL endpoint
    – Protégé
    – Jastor
    – Facebook graph API
    – Jena
                                                  4
Overview
•   Protégé 4.1 (data modeling)
•   Jastor library (RDF to POJO)
•   Facebook graph API
•   RestFB*
•   Jena/Jastor




                                   5
Setup Joseki (Jena)
• Joskei is an HTTP engine that supports SPRAQL;
  (use jetty, support ARQ for Jena)
    – configuration as turtle file
• Get Jena 2.6.3, tdb 0.8.7, Joseki 3.4.2 at
  http://sourceforge.net/projects/jena/files/
    – or go to
      http://dig.csail.mit.edu/2010/aintno/rdfData/aintno_j
      oseki.tar.gz for everything in one zip file
    – Jena is now an Apache Incubator program
      (http://incubator.apache.org/jena/index.html)

 source: http://ricroberts.com/articles/installing-jena-and-joseki-on-os-x-or-linux   6
Setup environment
• export JOSEKIROOT=/path/to/Joseki-3.4.2
• export TDBROOT=/path/to/TDB-0.8.7
• export JENAROOT=/path/to/Jena-2.6.3
• export
  CLASSPATH=.:$JENAROOT/lib/*.jar:$TDBROOT/lib/*.jar:
  $JOSEIKIROOT/lib/*.jar
• export PATH=“$TDBROOT/bin:$JOSEKIROOT/bin:$PATH
• if you download the all-in-one package(* I have put all
  jars under Joseki’s lib folder)
    – export JOSEKIROOT="/path/to/Joseki-aintno”
    – export PATH="$JOSEKIROOT/bin:$PATH”
    – export CLASSPATH=".:$JOSEKIROOT/lib/*.jar"
                                                        7
Run Joseki
• cd /path/to/Joseki
• ./bin/rdfserver
  – ./bin/rdfserver - - help
    (joseki.rdfserver [--verbose] [--port N] dataSourceConfigFile)
• Now open browser at http://localhost:2020/
  – test some of the SPARQL query interface with example
    data




                                                                     8
Joseki - Http access to SPARQL
           Endpoint




                                 9
Saveface
• Goal: save my Facebook data as linked data
• Facebook *finally* provides restful API to
  access its data (Facebook Graph API)
  – http://developers.facebook.com/docs/reference/a
    pi/
  – graph structure (e.g. Album class)
     • http://developers.facebook.com/docs/reference/api/al
       bum/


                                                          10
From Data model to Java POJO
• Used Protégé to create owl class for each of the
  Facebook classes
  – be aware that mapping from OO to ontology needs
    cares
  – serialize as RDF files
• Mapping ontologies (owl files) to JAVA classes
  – used Jastor library to generates Java
    interfaces, implementations, factories, and listeners
    based on the properties and class hierarchies in the
    Web ontologies
  – easier for non-Semantic Web java developer to make
    use of ontology

                                                            11
Jastor
• Typesafe, Ontology Driven RDF Access from Java
  http://jastor.sourceforge.net/
   – Use Jena 2.4
• Provides an interface for
  access/setting/adding event listeners to RDF
  model                      Jastor
                               Operator     listener
  iCal      SIOC
                   Mapping
                     tool
  Tag       FOAF
                             Jena2 Platform
                             (RDF model + Reasoning Engine +
                             Persistence System)               RDF DB
 Ontology
 files

                                          JAVA VM                   12
Example
                         Create mapping

JastorContext ctx = new JastorContext();
ctx.addOntologyToGenerate(new FileInputStream("src/data/Tag.owl"),
        "http://www.mit.edu/dig/ns/tag",
        "edu.mit.dig.model.Tag");

JastorGenerator gen = new JastorGenerator(
              new File("gensrc").getCanonicalFile(),
              ctx);
gen.run();

                         Make use of the class
Tag tag = edu.mit.dig.model.Tag.tagFactory.createTag(NS_PREFIX + "id_1", model);

tag.addName("A tag");
tag.addX(45);
tag.addY(32);
                                                                                   13
RestFB + RDF
• Facebook graph API client
• Forked RestFB 1.5.4 and added RDFUtil.java
  – used java reflection to covert each FB objects in
    RestFB to Jena RDF model (method toRDF())
• Default domain name for Saveface data
  – http://servername:port_num/data/saveface/




                                                        14
Demo
• git clone git@github.com:fumingshih/savefaceDemo.git
• Login to your Facebook
• Go to http://developers.facebook.com/docs/reference/api/
   – click on one of the links to view your content in json format (graph)
   – copy the access_token after
     https://graph.facebook.com/me/friends?access_token
• Run saveface.tutorial.Exercise1.java
   – paste the access_token string (* only valid for one
     hour)
   – change the directory for storing RDF (TDB files)

                                                                             15
Access SaveFace Data through Joseki
• Open /path/to/your/Joseki/joseki-config.ttl
• Three concepts in the configuration files
   – services
      • Services are the points that request are sent to
      • Need to specify dataset and processor
      • Note that the service reference and the routing of incoming
        requests by URI as defined by web.xml have to align
   – datasets
      • can be path to the dataset
      • or using Jena assembler description to compile different named
        graphs together
   – processors
      • set limitations on SPARQL queries (locking, no FROM/FROM
        NAMED)

                                                                               16
                         Reference: http://www.joseki.org/configuration.html
Configuration Example (Service)
 # Service 3 - SPARQL processor only handing a given dataset(TDB)
 <#service3>
   rdf:type        joseki:Service ;
   rdfs:label      "SPARQL on the named graph of saveface" ;
   joseki:serviceRef "saveface" ; # web.xml must route this name to Joseki

   # dataset part
   joseki:dataset   <#savefacedata> ;

   # Service part.
   # This processor will not allow either the protocol,
   # nor the query, to specify the dataset.
   joseki:processor joseki:ProcessorSPARQL_MultiDS ;
   .




                                                                             17
Configuration Example (Dataset)

  # init tdb
  [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" .

  tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset .
  tdb:GraphTDB rdfs:subClassOf ja:Model .

  <#savefacedata> rdf:type tdb:DatasetTDB ;
    rdfs:label "saveface dataset" ;
  #change this line below to your path to the dataset
   tdb:location "/Users/fuming/tmp/saveface_demo" ;
    .




                                                        18
Facebook Data as Linked Data!

• Change graph name to <urn:saveface:dataGraph:FumingShih>
  in the SPARQL query




                                                         19
References
• http://incubator.apache.org/jena/index.html
• http://www.joseki.org/
• Graph API
   – http://developers.facebook.com/docs/reference/api/
• Jastor
   – http://jastor.sourceforge.net/
• RestFB (http://restfb.com/ )
   – FB API browser (http://zestyping.livejournal.com/257224.html)
• SavefaceDemo
   – https://github.com/fumingshih/savefaceDemo
   – More on Saveface demo
       • http://dice.csail.mit.edu/aintno/ui/#aintno
       • http://dig.csail.mit.edu/wiki/SocialWebs_Data_Crawler/RDF_Repository_Setu
         p


                                                                                 20

Mais conteúdo relacionado

Mais procurados

GDG Meets U event - Big data & Wikidata - no lies codelab
GDG Meets U event - Big data & Wikidata -  no lies codelabGDG Meets U event - Big data & Wikidata -  no lies codelab
GDG Meets U event - Big data & Wikidata - no lies codelabCAMELIA BOBAN
 
SemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsRinke Hoekstra
 
Deploying PHP applications using Virtuoso as Application Server
Deploying PHP applications using Virtuoso as Application ServerDeploying PHP applications using Virtuoso as Application Server
Deploying PHP applications using Virtuoso as Application Serverwebhostingguy
 
Linked Data Tutorial
Linked Data TutorialLinked Data Tutorial
Linked Data TutorialSören Auer
 
RDFa: an introduction
RDFa: an introductionRDFa: an introduction
RDFa: an introductionKai Li
 
쉽게 이해하는 LOD
쉽게 이해하는 LOD쉽게 이해하는 LOD
쉽게 이해하는 LODMyungjin Lee
 
Linked Data - Radical Change?
Linked Data -  Radical Change?Linked Data -  Radical Change?
Linked Data - Radical Change?Richard Wallis
 
The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)Myungjin Lee
 
Webinar: Semantic web for developers
Webinar: Semantic web for developersWebinar: Semantic web for developers
Webinar: Semantic web for developersSemantic Web Company
 
RDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaRDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaPlatypus
 
Do the LOCAH-Motion: How to Make Bibliographic and Archival Linked Data
Do the LOCAH-Motion: How to Make Bibliographic and Archival Linked DataDo the LOCAH-Motion: How to Make Bibliographic and Archival Linked Data
Do the LOCAH-Motion: How to Make Bibliographic and Archival Linked DataAdrian Stevenson
 
Semantic Web
Semantic WebSemantic Web
Semantic Webhardchiu
 
Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02eswcsummerschool
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and SemanticsTatiana Al-Chueyr
 

Mais procurados (20)

GDG Meets U event - Big data & Wikidata - no lies codelab
GDG Meets U event - Big data & Wikidata -  no lies codelabGDG Meets U event - Big data & Wikidata -  no lies codelab
GDG Meets U event - Big data & Wikidata - no lies codelab
 
Jena Programming
Jena ProgrammingJena Programming
Jena Programming
 
SemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n BoltsSemanticWeb Nuts 'n Bolts
SemanticWeb Nuts 'n Bolts
 
Deploying PHP applications using Virtuoso as Application Server
Deploying PHP applications using Virtuoso as Application ServerDeploying PHP applications using Virtuoso as Application Server
Deploying PHP applications using Virtuoso as Application Server
 
Linked Data Tutorial
Linked Data TutorialLinked Data Tutorial
Linked Data Tutorial
 
RDFa: an introduction
RDFa: an introductionRDFa: an introduction
RDFa: an introduction
 
쉽게 이해하는 LOD
쉽게 이해하는 LOD쉽게 이해하는 LOD
쉽게 이해하는 LOD
 
4 sw architectures and sparql
4 sw architectures and sparql4 sw architectures and sparql
4 sw architectures and sparql
 
Linked Data - Radical Change?
Linked Data -  Radical Change?Linked Data -  Radical Change?
Linked Data - Radical Change?
 
The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)The Semantic Web #9 - Web Ontology Language (OWL)
The Semantic Web #9 - Web Ontology Language (OWL)
 
SWT Lecture Session 2 - RDF
SWT Lecture Session 2 - RDFSWT Lecture Session 2 - RDF
SWT Lecture Session 2 - RDF
 
Webinar: Semantic web for developers
Webinar: Semantic web for developersWebinar: Semantic web for developers
Webinar: Semantic web for developers
 
XSPARQL Tutorial
XSPARQL TutorialXSPARQL Tutorial
XSPARQL Tutorial
 
RDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFaRDFa Introductory Course Session 2/4 How RDFa
RDFa Introductory Course Session 2/4 How RDFa
 
Do the LOCAH-Motion: How to Make Bibliographic and Archival Linked Data
Do the LOCAH-Motion: How to Make Bibliographic and Archival Linked DataDo the LOCAH-Motion: How to Make Bibliographic and Archival Linked Data
Do the LOCAH-Motion: How to Make Bibliographic and Archival Linked Data
 
Semantic Web
Semantic WebSemantic Web
Semantic Web
 
Jena framework
Jena frameworkJena framework
Jena framework
 
Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02Mon norton tut_queryinglinkeddata02
Mon norton tut_queryinglinkeddata02
 
Linking the world with Python and Semantics
Linking the world with Python and SemanticsLinking the world with Python and Semantics
Linking the world with Python and Semantics
 
RDFa Everywhere
RDFa EverywhereRDFa Everywhere
RDFa Everywhere
 

Semelhante a Saveface - Save your Facebook content as RDF data

Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic WebLuigi De Russis
 
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...Anne Nicolas
 
Presentation distro recipes-2013
Presentation distro recipes-2013Presentation distro recipes-2013
Presentation distro recipes-2013olberger
 
Rapid API Development ArangoDB Foxx
Rapid API Development ArangoDB FoxxRapid API Development ArangoDB Foxx
Rapid API Development ArangoDB FoxxMichael Hackstein
 
S. Bartoli & F. Pompermaier – A Semantic Big Data Companion
S. Bartoli & F. Pompermaier – A Semantic Big Data CompanionS. Bartoli & F. Pompermaier – A Semantic Big Data Companion
S. Bartoli & F. Pompermaier – A Semantic Big Data CompanionFlink Forward
 
Large scale crawling with Apache Nutch
Large scale crawling with Apache NutchLarge scale crawling with Apache Nutch
Large scale crawling with Apache NutchJulien Nioche
 
SuRf – Tapping Into The Web Of Data
SuRf – Tapping Into The Web Of DataSuRf – Tapping Into The Web Of Data
SuRf – Tapping Into The Web Of Datacosbas
 
Real time Analytics with Apache Kafka and Apache Spark
Real time Analytics with Apache Kafka and Apache SparkReal time Analytics with Apache Kafka and Apache Spark
Real time Analytics with Apache Kafka and Apache SparkRahul Jain
 
Integrating an electronic lab notebook with a university it environment rdmf ...
Integrating an electronic lab notebook with a university it environment rdmf ...Integrating an electronic lab notebook with a university it environment rdmf ...
Integrating an electronic lab notebook with a university it environment rdmf ...rmacneil88
 
Rdf Processing Tools In Java
Rdf Processing Tools In JavaRdf Processing Tools In Java
Rdf Processing Tools In JavaDicusarCorneliu
 
Hadoop and object stores can we do it better
Hadoop and object stores  can we do it betterHadoop and object stores  can we do it better
Hadoop and object stores can we do it bettergvernik
 
Hadoop and object stores: Can we do it better?
Hadoop and object stores: Can we do it better?Hadoop and object stores: Can we do it better?
Hadoop and object stores: Can we do it better?gvernik
 
Jsf2 composite-components
Jsf2 composite-componentsJsf2 composite-components
Jsf2 composite-componentsvinaysbk
 
Web data from R
Web data from RWeb data from R
Web data from Rschamber
 
Comparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java PlatformComparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java PlatformComputer Science
 
ContextualContinuous Profilng
ContextualContinuous ProfilngContextualContinuous Profilng
ContextualContinuous ProfilngJaroslav Bachorik
 

Semelhante a Saveface - Save your Facebook content as RDF data (20)

01 spring-intro
01 spring-intro01 spring-intro
01 spring-intro
 
Programming the Semantic Web
Programming the Semantic WebProgramming the Semantic Web
Programming the Semantic Web
 
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
Distro Recipes 2013 : Contribution of RDF metadata for traceability among pro...
 
Presentation distro recipes-2013
Presentation distro recipes-2013Presentation distro recipes-2013
Presentation distro recipes-2013
 
Rapid API Development ArangoDB Foxx
Rapid API Development ArangoDB FoxxRapid API Development ArangoDB Foxx
Rapid API Development ArangoDB Foxx
 
Apache Marmotta - Introduction
Apache Marmotta - IntroductionApache Marmotta - Introduction
Apache Marmotta - Introduction
 
RDFauthor (EKAW)
RDFauthor (EKAW)RDFauthor (EKAW)
RDFauthor (EKAW)
 
S. Bartoli & F. Pompermaier – A Semantic Big Data Companion
S. Bartoli & F. Pompermaier – A Semantic Big Data CompanionS. Bartoli & F. Pompermaier – A Semantic Big Data Companion
S. Bartoli & F. Pompermaier – A Semantic Big Data Companion
 
Large scale crawling with Apache Nutch
Large scale crawling with Apache NutchLarge scale crawling with Apache Nutch
Large scale crawling with Apache Nutch
 
SuRf – Tapping Into The Web Of Data
SuRf – Tapping Into The Web Of DataSuRf – Tapping Into The Web Of Data
SuRf – Tapping Into The Web Of Data
 
Real time Analytics with Apache Kafka and Apache Spark
Real time Analytics with Apache Kafka and Apache SparkReal time Analytics with Apache Kafka and Apache Spark
Real time Analytics with Apache Kafka and Apache Spark
 
Integrating an electronic lab notebook with a university it environment rdmf ...
Integrating an electronic lab notebook with a university it environment rdmf ...Integrating an electronic lab notebook with a university it environment rdmf ...
Integrating an electronic lab notebook with a university it environment rdmf ...
 
Rdf Processing Tools In Java
Rdf Processing Tools In JavaRdf Processing Tools In Java
Rdf Processing Tools In Java
 
Hadoop and object stores can we do it better
Hadoop and object stores  can we do it betterHadoop and object stores  can we do it better
Hadoop and object stores can we do it better
 
Hadoop and object stores: Can we do it better?
Hadoop and object stores: Can we do it better?Hadoop and object stores: Can we do it better?
Hadoop and object stores: Can we do it better?
 
Jsf2 composite-components
Jsf2 composite-componentsJsf2 composite-components
Jsf2 composite-components
 
Web data from R
Web data from RWeb data from R
Web data from R
 
PyFilesystem
PyFilesystemPyFilesystem
PyFilesystem
 
Comparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java PlatformComparative Study That Aims Rdf Processing For The Java Platform
Comparative Study That Aims Rdf Processing For The Java Platform
 
ContextualContinuous Profilng
ContextualContinuous ProfilngContextualContinuous Profilng
ContextualContinuous Profilng
 

Último

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 

Último (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 

Saveface - Save your Facebook content as RDF data

  • 1. Saveface – Save Facebook’s data as RDF graph Using Jena, Joseki & FB graph API Fuming Shih fuming@mit.edu
  • 2. About Me • 4th year graduate student at CSAIL, working with Hal Abelson • Member of DIG group (decentralized information group) at CSAIL • Working on topics relating to privacy, mobile context, and accountability 2
  • 3. Saveflickr Saveface Simond Secono's Walled Gardens Picture, taken from TimBL's presentation 3
  • 4. Outline • Demo Saveface SPARQL endpoint • Overview • Set up Joseki SPARQL endpoint • From Protégé (data modeling) to Jena/Jaster (RDF library/SPARQL endpoint – Protégé – Jastor – Facebook graph API – Jena 4
  • 5. Overview • Protégé 4.1 (data modeling) • Jastor library (RDF to POJO) • Facebook graph API • RestFB* • Jena/Jastor 5
  • 6. Setup Joseki (Jena) • Joskei is an HTTP engine that supports SPRAQL; (use jetty, support ARQ for Jena) – configuration as turtle file • Get Jena 2.6.3, tdb 0.8.7, Joseki 3.4.2 at http://sourceforge.net/projects/jena/files/ – or go to http://dig.csail.mit.edu/2010/aintno/rdfData/aintno_j oseki.tar.gz for everything in one zip file – Jena is now an Apache Incubator program (http://incubator.apache.org/jena/index.html) source: http://ricroberts.com/articles/installing-jena-and-joseki-on-os-x-or-linux 6
  • 7. Setup environment • export JOSEKIROOT=/path/to/Joseki-3.4.2 • export TDBROOT=/path/to/TDB-0.8.7 • export JENAROOT=/path/to/Jena-2.6.3 • export CLASSPATH=.:$JENAROOT/lib/*.jar:$TDBROOT/lib/*.jar: $JOSEIKIROOT/lib/*.jar • export PATH=“$TDBROOT/bin:$JOSEKIROOT/bin:$PATH • if you download the all-in-one package(* I have put all jars under Joseki’s lib folder) – export JOSEKIROOT="/path/to/Joseki-aintno” – export PATH="$JOSEKIROOT/bin:$PATH” – export CLASSPATH=".:$JOSEKIROOT/lib/*.jar" 7
  • 8. Run Joseki • cd /path/to/Joseki • ./bin/rdfserver – ./bin/rdfserver - - help (joseki.rdfserver [--verbose] [--port N] dataSourceConfigFile) • Now open browser at http://localhost:2020/ – test some of the SPARQL query interface with example data 8
  • 9. Joseki - Http access to SPARQL Endpoint 9
  • 10. Saveface • Goal: save my Facebook data as linked data • Facebook *finally* provides restful API to access its data (Facebook Graph API) – http://developers.facebook.com/docs/reference/a pi/ – graph structure (e.g. Album class) • http://developers.facebook.com/docs/reference/api/al bum/ 10
  • 11. From Data model to Java POJO • Used Protégé to create owl class for each of the Facebook classes – be aware that mapping from OO to ontology needs cares – serialize as RDF files • Mapping ontologies (owl files) to JAVA classes – used Jastor library to generates Java interfaces, implementations, factories, and listeners based on the properties and class hierarchies in the Web ontologies – easier for non-Semantic Web java developer to make use of ontology 11
  • 12. Jastor • Typesafe, Ontology Driven RDF Access from Java http://jastor.sourceforge.net/ – Use Jena 2.4 • Provides an interface for access/setting/adding event listeners to RDF model Jastor Operator listener iCal SIOC Mapping tool Tag FOAF Jena2 Platform (RDF model + Reasoning Engine + Persistence System) RDF DB Ontology files JAVA VM 12
  • 13. Example Create mapping JastorContext ctx = new JastorContext(); ctx.addOntologyToGenerate(new FileInputStream("src/data/Tag.owl"), "http://www.mit.edu/dig/ns/tag", "edu.mit.dig.model.Tag"); JastorGenerator gen = new JastorGenerator( new File("gensrc").getCanonicalFile(), ctx); gen.run(); Make use of the class Tag tag = edu.mit.dig.model.Tag.tagFactory.createTag(NS_PREFIX + "id_1", model); tag.addName("A tag"); tag.addX(45); tag.addY(32); 13
  • 14. RestFB + RDF • Facebook graph API client • Forked RestFB 1.5.4 and added RDFUtil.java – used java reflection to covert each FB objects in RestFB to Jena RDF model (method toRDF()) • Default domain name for Saveface data – http://servername:port_num/data/saveface/ 14
  • 15. Demo • git clone git@github.com:fumingshih/savefaceDemo.git • Login to your Facebook • Go to http://developers.facebook.com/docs/reference/api/ – click on one of the links to view your content in json format (graph) – copy the access_token after https://graph.facebook.com/me/friends?access_token • Run saveface.tutorial.Exercise1.java – paste the access_token string (* only valid for one hour) – change the directory for storing RDF (TDB files) 15
  • 16. Access SaveFace Data through Joseki • Open /path/to/your/Joseki/joseki-config.ttl • Three concepts in the configuration files – services • Services are the points that request are sent to • Need to specify dataset and processor • Note that the service reference and the routing of incoming requests by URI as defined by web.xml have to align – datasets • can be path to the dataset • or using Jena assembler description to compile different named graphs together – processors • set limitations on SPARQL queries (locking, no FROM/FROM NAMED) 16 Reference: http://www.joseki.org/configuration.html
  • 17. Configuration Example (Service) # Service 3 - SPARQL processor only handing a given dataset(TDB) <#service3> rdf:type joseki:Service ; rdfs:label "SPARQL on the named graph of saveface" ; joseki:serviceRef "saveface" ; # web.xml must route this name to Joseki # dataset part joseki:dataset <#savefacedata> ; # Service part. # This processor will not allow either the protocol, # nor the query, to specify the dataset. joseki:processor joseki:ProcessorSPARQL_MultiDS ; . 17
  • 18. Configuration Example (Dataset) # init tdb [] ja:loadClass "com.hp.hpl.jena.tdb.TDB" . tdb:DatasetTDB rdfs:subClassOf ja:RDFDataset . tdb:GraphTDB rdfs:subClassOf ja:Model . <#savefacedata> rdf:type tdb:DatasetTDB ; rdfs:label "saveface dataset" ; #change this line below to your path to the dataset tdb:location "/Users/fuming/tmp/saveface_demo" ; . 18
  • 19. Facebook Data as Linked Data! • Change graph name to <urn:saveface:dataGraph:FumingShih> in the SPARQL query 19
  • 20. References • http://incubator.apache.org/jena/index.html • http://www.joseki.org/ • Graph API – http://developers.facebook.com/docs/reference/api/ • Jastor – http://jastor.sourceforge.net/ • RestFB (http://restfb.com/ ) – FB API browser (http://zestyping.livejournal.com/257224.html) • SavefaceDemo – https://github.com/fumingshih/savefaceDemo – More on Saveface demo • http://dice.csail.mit.edu/aintno/ui/#aintno • http://dig.csail.mit.edu/wiki/SocialWebs_Data_Crawler/RDF_Repository_Setu p 20