Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

PGXユーザ勉強会#10 G2GML+PGXでRDFグラフを解析してみよう

24 views

Published on

PGXユーザ勉強会#10 にて紹介

Published in: Engineering
  • Be the first to comment

  • Be the first to like this

PGXユーザ勉強会#10 G2GML+PGXでRDFグラフを解析してみよう

  1. 1. + GL12 50 # # / MF # 8 D
  2. 2. RDF F 2 ! D ! R R R F ! 2
  3. 3. G2GML ! BD BD M ! G2G Mapper L (https://github.com/g2gml/g2g) ! BD RP FG
  4. 4. DBpedia
  5. 5. G2GML # PREFIX # Node mapping (mus:Musician {vis_label:nam, born:dat, hometown:twn}) ?mus rdf:type foaf:Person, dbpedia-owl:MusicalArtist . ?mus rdfs:label ?nam . OPTIONAL { ?mus prop:born ?dat } OPTIONAL { ?mus dbpedia-owl:hometown / rdfs:label ?twn } # Edge mapping (mus1:Musician)-[:same_group {label:nam, length:len}]->(mus2:Musician) ?grp a schema:MusicGroup ; dbpedia-owl:bandMember ?mus1 , ?mus2 . FILTER(?mus1 != ?mus2) OPTIONAL { ?grp rdfs:label ?nam. FILTER(lang(?nam) = "ja")} OPTIONAL { ?grp dbpedia-owl:wikiPageLength
  6. 6. G2GML # PREFIX # Node mapping (mus:Musician {vis_label:nam, born:dat, hometown:twn}) ?mus rdf:type foaf:Person, dbpedia-owl:MusicalArtist . ?mus rdfs:label ?nam . OPTIONAL { ?mus prop:born ?dat } OPTIONAL { ?mus dbpedia-owl:hometown / rdfs:label ?twn } # Edge mapping (mus1:Musician)-[:same_group {label:nam, length:len}]->(mus2:Musician) ?grp a schema:MusicGroup ; dbpedia-owl:bandMember ?mus1 , ?mus2 . FILTER(?mus1 != ?mus2) OPTIONAL { ?grp rdfs:label ?nam. FILTER(lang(?nam) = "ja")} OPTIONAL { ?grp dbpedia-owl:wikiPageLength RDF RDF
  7. 7. M a… (Docker G2GML RDF _ $ g2g -f pgx examples/musician/musician.g2g http://ja.dbpedia.org/sparql / . / . / / / / / / / / / / / / PGX G2GML RDF
  8. 8. : PGX $ pgx PGX Shell 2.7.0 type :help for available commands 16:06:39,147 INFO Ctrl$1 - >>> PGX engine running. pgx> G = session.readGraphWithProperties("./output/musician/pgx/musician.pgx.json") ==> PgxGraph[name=musician.pgx,N=1898,E=6094,created=1540456589554] PGX
  9. 9. PGX PGQL (1) pgx> G.queryPgql("SELECT DISTINCT m1.name, m2.name WHERE (m1 WITH name != '')-[same_group]-(m2 WITH name != '')").print(10) +-------------------------------+ | m1.name | m2.name | +-------------------------------+ | ACE ( ) | | | ACE ( ) | | | ACE ( ) | | | ACE ( ) | | | AKINA ( ) | | | ANZA | | | ANZA | | | ANZA | | | ASAKI | Kyo ( ) | | ATSUSHI ( ) | NESMITH | +-------------------------------+
  10. 10. PGX PGQL (2) pgx> G.queryPgql("SELECT m1.name, count(m2) WHERE (m1)-[same_group]->(m2) group by m1.name").print(10) +------------------------------+ | m1.name | count(m2) | +------------------------------+ | | 2 | | | 4 | | | 4 | | | 1 | | | 3 | | B | 2 | | | 1 | | | 3 | | | 3 | | | 2 | +------------------------------+
  11. 11. 444 ! ( ( ( W N a G ! S e A

×