SlideShare uma empresa Scribd logo
1 de 24
$ git clone https://github.com/webr3/js3.git
$ git checkout origin/rdfa-api-integration



<script type=”text/javascript” src=”js3.js”></script>




var js3 = require(‘./js3.node.js’);
var context = new rdfapi.Context();
var parser = new rdfapi.parsers.Turtle(context);
var serializer = new rdfapi.serializers.Turtle(context);

var turtle_text = ‘@prefix ex: <http://example.com/people/> .¥
    @prefix foaf: <http://xmlns.com/foaf/0.1/> .¥
¥
    ex:taro a foaf:Person;¥
        foaf:name “Taro”;¥
        foaf:age 25 .’;

parser.parse(turtle_text, function(graph){
    console.log(serializer.serialize(graph));
});
parser.parse(turtle_text, function(graph){
    graph.forEach(function(triple){ // show each triples
        console.log(triple.toString());
    })

      graph.add(triple2); // add a triple to the graph

      // use filter
      var filter = rdfapi.filters.p(“owl:sameAs”);
      graph.some(filter);
      graph.every(filter);
      graph.filter(filter);

      graph.merge(other_graph);
});
var taro = {
    a: “foaf:Person”,
    name: “Taro Yamada”,
    age: new Date().getFullYear() - 1984,
    homepage: “http://example.com/home/taro”
}.ref(“http://example.com/rdf/taro”);

console.log(taro.n3());
var taro = {
    a: “foaf:Person”,
    name: “Taro Yamada”,
    age: new Date().getFullYear() - 1984,
    homepage: “http://example.com/home/taro”
}.ref(“http://example.com/rdf/taro”);

console.log(taro.n3());
var taro = {
    a: “foaf:Person”,
    name: “Taro Yamada”,
    age: new Date().getFullYear() - 1984,
    homepage: “http://example.com/home/taro”
}.ref(“http://example.com/rdf/taro”);

console.log(taro.n3());
var taro = {
    a: “foaf:Person”,
    name: “Taro Yamada”,
    age: new Date().getFullYear() - 1984,
    homepage: “http://example.com/home/taro”
}.ref(“http://example.com/rdf/taro”);

console.log(taro.n3());
var taro = {
    a: “foaf:Person”,
    name: “Taro Yamada”,
    age: new Date().getFullYear() - 1984,
    homepage: “http://example.com/home/taro”
}.ref(“http://example.com/rdf/taro”);

console.log(taro.n3());


                           ↓
var taro = {
    a: “foaf:Person”,
    name: “Taro Yamada”,
    age: new Date().getFullYear() - 1984,
    homepage: “http://example.com/home/taro”
}.ref(“http://example.com/rdf/taro”);

console.log(taro.n3());


                           ↓
   <http://example.com/rdf/taro> rdf:type foaf:Person;
       foaf:name “Taro Yamada”;
       foaf:age 27;
       foaf:homepage <http://example.com/home/taro> .
// TypedLiteral    .type      IRI            (       CURIE   )
(true).type;         //=>   xsd:boolean
(new Date()).type;   //=>   xsd:dateTime
(10).type;           //=>   xsd:integer
(3.14).type;         //=>   xsd:decimal

// .nodeType()    TypedLiteral, PlainLiteral, BlankNode, IRI
(10).nodeType();                      //=>   TypedLiteral
“hello”.nodeType();                   //=>   PlainLiteral
“_:b12”.nodeType();                   //=>   BlankNode
“foaf:name”.nodeType();               //=>   IRI
“http://example.com/”.nodeType();     //=>   IRI
// foaf:name   2
var me1 = { “foaf:nick”: [“nick”, “name”] }.ref();

// RDF List
var me2 = { “foaf:nick”: [“nick”, “name”].toList() }.ref();
var taro = {
    name: “Taro”,
    holdsAccount: {
        accountName: ‘xxx’,
        homepage: ‘http://twitter.com/xxx’,
    }
}.ref(“:taro”);




var jiro = { “foaf:knows”: taro }.ref(“:jiro”);
var me = { name: “Taro”, age: 27 }.ref(“:me”);
console.log(typeof me.age);                       //=> number
console.log((new Date()).getFullYear() - me.age); //=> 1984
console.log(me.name.toUpper());                   //=> “TARO”
// parsing by rdfapi.js
parser.parse(“SOME RDF STRING”, function(graph){
    var data = {
        a: “foaf:Document”,
        ...,
    }.ref(“:book”);

      graph.merge(data.graphify()); //
});
rdfapi.js and js3.js by webr3
rdfapi.js and js3.js by webr3

Mais conteúdo relacionado

Mais procurados

MongoDB Advanced Topics
MongoDB Advanced TopicsMongoDB Advanced Topics
MongoDB Advanced Topics
César Rodas
 
Php File Operations
Php File OperationsPhp File Operations
Php File Operations
mussawir20
 

Mais procurados (20)

MongoDB Advanced Topics
MongoDB Advanced TopicsMongoDB Advanced Topics
MongoDB Advanced Topics
 
Files in c
Files in cFiles in c
Files in c
 
Php files
Php filesPhp files
Php files
 
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntu
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntuMengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntu
Mengembalikan data yang terhapus atau rusak pada hardisk menggunakan ubuntu
 
Agente Inteligente Ontologia y Tripletas
Agente Inteligente Ontologia y TripletasAgente Inteligente Ontologia y Tripletas
Agente Inteligente Ontologia y Tripletas
 
Files and Directories in PHP
Files and Directories in PHPFiles and Directories in PHP
Files and Directories in PHP
 
scdevsumit 2016 - Become a jedi with php streams
scdevsumit 2016 - Become a jedi with php streamsscdevsumit 2016 - Become a jedi with php streams
scdevsumit 2016 - Become a jedi with php streams
 
R- create a table from a list of files.... before webmining
R- create a table from a list of files.... before webminingR- create a table from a list of files.... before webmining
R- create a table from a list of files.... before webmining
 
TDC São Paulo 2016 - Become a jedi with php streams
TDC São Paulo 2016 - Become a jedi with php streamsTDC São Paulo 2016 - Become a jedi with php streams
TDC São Paulo 2016 - Become a jedi with php streams
 
Sparql
SparqlSparql
Sparql
 
Filing system in PHP
Filing system in PHPFiling system in PHP
Filing system in PHP
 
Creating a phar
Creating a pharCreating a phar
Creating a phar
 
Scala and big data in ICM. Scoobie, Scalding, Spark, Stratosphere. Scalar 2014
Scala and big data in ICM. Scoobie, Scalding, Spark, Stratosphere. Scalar 2014Scala and big data in ICM. Scoobie, Scalding, Spark, Stratosphere. Scalar 2014
Scala and big data in ICM. Scoobie, Scalding, Spark, Stratosphere. Scalar 2014
 
Php file handling in Hindi
Php file handling in Hindi Php file handling in Hindi
Php file handling in Hindi
 
PHP file handling
PHP file handling PHP file handling
PHP file handling
 
Php File Operations
Php File OperationsPhp File Operations
Php File Operations
 
Be Lazy & Scale
Be Lazy & ScaleBe Lazy & Scale
Be Lazy & Scale
 
Non-Relational Databases
Non-Relational DatabasesNon-Relational Databases
Non-Relational Databases
 
TDC2016SP - Become a jedi with PHP streams
TDC2016SP - Become a jedi with PHP streamsTDC2016SP - Become a jedi with PHP streams
TDC2016SP - Become a jedi with PHP streams
 
Class 7b: Files & File I/O
Class 7b: Files & File I/OClass 7b: Files & File I/O
Class 7b: Files & File I/O
 

Destaque

第1回Linked Data勉強会:ReDeFer
第1回Linked Data勉強会:ReDeFer第1回Linked Data勉強会:ReDeFer
第1回Linked Data勉強会:ReDeFer
Noritada Shimizu
 
XLWrapについてのご紹介
XLWrapについてのご紹介XLWrapについてのご紹介
XLWrapについてのご紹介
Ohsawa Goodfellow
 
自然言語処理のためのDeep Learning
自然言語処理のためのDeep Learning自然言語処理のためのDeep Learning
自然言語処理のためのDeep Learning
Yuta Kikuchi
 

Destaque (11)

第1回Linked Data勉強会:ReDeFer
第1回Linked Data勉強会:ReDeFer第1回Linked Data勉強会:ReDeFer
第1回Linked Data勉強会:ReDeFer
 
Linkeddata.jp study meeting #1
Linkeddata.jp study meeting #1Linkeddata.jp study meeting #1
Linkeddata.jp study meeting #1
 
第1回LinkedData勉強会
第1回LinkedData勉強会第1回LinkedData勉強会
第1回LinkedData勉強会
 
XLWrapについてのご紹介
XLWrapについてのご紹介XLWrapについてのご紹介
XLWrapについてのご紹介
 
SPARQL Timelinerの使い方
SPARQL Timelinerの使い方SPARQL Timelinerの使い方
SPARQL Timelinerの使い方
 
Linked data the next 5 years - From Hype to Action
Linked data the next 5 years - From Hype to ActionLinked data the next 5 years - From Hype to Action
Linked data the next 5 years - From Hype to Action
 
SPARQLを利用した逆マッシュアップ-プログラミングを必要としないアプリ作成方法-
SPARQLを利用した逆マッシュアップ-プログラミングを必要としないアプリ作成方法-SPARQLを利用した逆マッシュアップ-プログラミングを必要としないアプリ作成方法-
SPARQLを利用した逆マッシュアップ-プログラミングを必要としないアプリ作成方法-
 
第7回 Linked Data 勉強会 @yayamamo
第7回 Linked Data 勉強会 @yayamamo第7回 Linked Data 勉強会 @yayamamo
第7回 Linked Data 勉強会 @yayamamo
 
Chainerの使い方と 自然言語処理への応用
Chainerの使い方と自然言語処理への応用Chainerの使い方と自然言語処理への応用
Chainerの使い方と 自然言語処理への応用
 
自然言語処理のためのDeep Learning
自然言語処理のためのDeep Learning自然言語処理のためのDeep Learning
自然言語処理のためのDeep Learning
 
深層学習による自然言語処理の研究動向
深層学習による自然言語処理の研究動向深層学習による自然言語処理の研究動向
深層学習による自然言語処理の研究動向
 

Semelhante a rdfapi.js and js3.js by webr3

Yy
YyYy
Yy
yygh
 
Yy
YyYy
Yy
yygh
 
Nouveau document texte
Nouveau document texteNouveau document texte
Nouveau document texte
Sai Ef
 
An introduction to Semantic Web and Linked Data
An introduction to Semantic Web and Linked DataAn introduction to Semantic Web and Linked Data
An introduction to Semantic Web and Linked Data
Gabriela Agustini
 

Semelhante a rdfapi.js and js3.js by webr3 (20)

Having Fun Programming!
Having Fun Programming!Having Fun Programming!
Having Fun Programming!
 
JavaScript Survival Guide
JavaScript Survival GuideJavaScript Survival Guide
JavaScript Survival Guide
 
Two graph data models : RDF and Property Graphs
Two graph data models : RDF and Property GraphsTwo graph data models : RDF and Property Graphs
Two graph data models : RDF and Property Graphs
 
Development and practical use of CLI in perl 6
Development and practical use of CLI in perl 6Development and practical use of CLI in perl 6
Development and practical use of CLI in perl 6
 
Cod
CodCod
Cod
 
Fisier.txt
Fisier.txtFisier.txt
Fisier.txt
 
C99
C99C99
C99
 
NoSQL and Triple Stores
NoSQL and Triple StoresNoSQL and Triple Stores
NoSQL and Triple Stores
 
Dades i operadors
Dades i operadorsDades i operadors
Dades i operadors
 
C99.php
C99.phpC99.php
C99.php
 
C99[2]
C99[2]C99[2]
C99[2]
 
Achieving Parsing Sanity In Erlang
Achieving Parsing Sanity In ErlangAchieving Parsing Sanity In Erlang
Achieving Parsing Sanity In Erlang
 
Rdf In A Nutshell V1
Rdf In A Nutshell V1Rdf In A Nutshell V1
Rdf In A Nutshell V1
 
Mapping Relational Databases to Linked Data
Mapping Relational Databases to Linked DataMapping Relational Databases to Linked Data
Mapping Relational Databases to Linked Data
 
Yy
YyYy
Yy
 
Yy
YyYy
Yy
 
Nouveau document texte
Nouveau document texteNouveau document texte
Nouveau document texte
 
SHACL in Apache jena - ApacheCon2020
SHACL in Apache jena - ApacheCon2020SHACL in Apache jena - ApacheCon2020
SHACL in Apache jena - ApacheCon2020
 
JavaScript - Like a Box of Chocolates - jsDay
JavaScript - Like a Box of Chocolates - jsDayJavaScript - Like a Box of Chocolates - jsDay
JavaScript - Like a Box of Chocolates - jsDay
 
An introduction to Semantic Web and Linked Data
An introduction to Semantic Web and Linked DataAn introduction to Semantic Web and Linked Data
An introduction to Semantic Web and Linked Data
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
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
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

rdfapi.js and js3.js by webr3

  • 1.
  • 2.
  • 3. $ git clone https://github.com/webr3/js3.git $ git checkout origin/rdfa-api-integration <script type=”text/javascript” src=”js3.js”></script> var js3 = require(‘./js3.node.js’);
  • 4.
  • 5.
  • 6. var context = new rdfapi.Context(); var parser = new rdfapi.parsers.Turtle(context); var serializer = new rdfapi.serializers.Turtle(context); var turtle_text = ‘@prefix ex: <http://example.com/people/> .¥ @prefix foaf: <http://xmlns.com/foaf/0.1/> .¥ ¥ ex:taro a foaf:Person;¥ foaf:name “Taro”;¥ foaf:age 25 .’; parser.parse(turtle_text, function(graph){ console.log(serializer.serialize(graph)); });
  • 7. parser.parse(turtle_text, function(graph){ graph.forEach(function(triple){ // show each triples console.log(triple.toString()); }) graph.add(triple2); // add a triple to the graph // use filter var filter = rdfapi.filters.p(“owl:sameAs”); graph.some(filter); graph.every(filter); graph.filter(filter); graph.merge(other_graph); });
  • 8.
  • 9.
  • 10. var taro = { a: “foaf:Person”, name: “Taro Yamada”, age: new Date().getFullYear() - 1984, homepage: “http://example.com/home/taro” }.ref(“http://example.com/rdf/taro”); console.log(taro.n3());
  • 11. var taro = { a: “foaf:Person”, name: “Taro Yamada”, age: new Date().getFullYear() - 1984, homepage: “http://example.com/home/taro” }.ref(“http://example.com/rdf/taro”); console.log(taro.n3());
  • 12. var taro = { a: “foaf:Person”, name: “Taro Yamada”, age: new Date().getFullYear() - 1984, homepage: “http://example.com/home/taro” }.ref(“http://example.com/rdf/taro”); console.log(taro.n3());
  • 13. var taro = { a: “foaf:Person”, name: “Taro Yamada”, age: new Date().getFullYear() - 1984, homepage: “http://example.com/home/taro” }.ref(“http://example.com/rdf/taro”); console.log(taro.n3());
  • 14. var taro = { a: “foaf:Person”, name: “Taro Yamada”, age: new Date().getFullYear() - 1984, homepage: “http://example.com/home/taro” }.ref(“http://example.com/rdf/taro”); console.log(taro.n3()); ↓
  • 15. var taro = { a: “foaf:Person”, name: “Taro Yamada”, age: new Date().getFullYear() - 1984, homepage: “http://example.com/home/taro” }.ref(“http://example.com/rdf/taro”); console.log(taro.n3()); ↓ <http://example.com/rdf/taro> rdf:type foaf:Person; foaf:name “Taro Yamada”; foaf:age 27; foaf:homepage <http://example.com/home/taro> .
  • 16.
  • 17.
  • 18. // TypedLiteral .type IRI ( CURIE ) (true).type; //=> xsd:boolean (new Date()).type; //=> xsd:dateTime (10).type; //=> xsd:integer (3.14).type; //=> xsd:decimal // .nodeType() TypedLiteral, PlainLiteral, BlankNode, IRI (10).nodeType(); //=> TypedLiteral “hello”.nodeType(); //=> PlainLiteral “_:b12”.nodeType(); //=> BlankNode “foaf:name”.nodeType(); //=> IRI “http://example.com/”.nodeType(); //=> IRI
  • 19. // foaf:name 2 var me1 = { “foaf:nick”: [“nick”, “name”] }.ref(); // RDF List var me2 = { “foaf:nick”: [“nick”, “name”].toList() }.ref();
  • 20. var taro = { name: “Taro”, holdsAccount: { accountName: ‘xxx’, homepage: ‘http://twitter.com/xxx’, } }.ref(“:taro”); var jiro = { “foaf:knows”: taro }.ref(“:jiro”);
  • 21. var me = { name: “Taro”, age: 27 }.ref(“:me”); console.log(typeof me.age); //=> number console.log((new Date()).getFullYear() - me.age); //=> 1984 console.log(me.name.toUpper()); //=> “TARO”
  • 22. // parsing by rdfapi.js parser.parse(“SOME RDF STRING”, function(graph){ var data = { a: “foaf:Document”, ..., }.ref(“:book”); graph.merge(data.graphify()); // });

Notas do Editor

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n