node.js - JSON-LD framing delete useless objects -


have solution when framed 1 json file , after delete small, useless objects? or create 1 big object contains small objects? not understand @context parameters. sry bad eng hope understandable.

here example on json-ld playground

input json:

{   "@context": {     "@bib": "http://purl.org/net/biblio#",     "@dc": "http://purl.org/dc/elements/1.1/",     "@foat": "http://xmlns.com/foaf/0.1/",     "@link": "http://purl.org/rss/1.0/modules/link/",     "@prism": "http://prismstandard.org/namespaces/1.2/basic/",     "@rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",     "@vocab": "http://purl.org/dc/terms/",     "@zotero": "http://www.zotero.org/namespaces/export#"   },   "@graph": [     {       "@dc:identifier": {         "@id": "_:ndd041ac321a44525abce4bc6c976859a"       },       "@dc:title": "snapshot",       "@id": "file:///c://users/tamas/ideaprojects/szak/test/sample.rdf#item_5",       "@link:type": "text/html",       "@rdf:path": {         "@id": "_:n8b4366101b1b49fea486e69e35fa08eb"       },       "@type": "@zotero:attachment",       "@zotero:itemtype": "attachment",       "@zotero:linkmode": "1",       "datesubmitted": "2017-07-31 15:14:39"     },     {       "@id": "_:ndd041ac321a44525abce4bc6c976859a",       "@rdf:value": "https://hcommons.org/deposits/item/hc:12251/",       "@type": "uri"     },     {       "@id": "_:n8b4366101b1b49fea486e69e35fa08eb",       "@rdf:path": "files/5/hc12251.html"     },     {       "@dc:identifier": {         "@id": "_:n81fa7118b0284a699cf7fa995272931d"       },       "@dc:title": "full text pdf",       "@id": "file:///c://users/tamas/ideaprojects/szak/test/sample.rdf#item_4",       "@link:type": "application/pdf",       "@rdf:path": {         "@id": "_:n87a1b8119dff4b1f98354c8593862abb"       },       "@type": "@zotero:attachment",       "@zotero:itemtype": "attachment",       "@zotero:linkmode": "1",       "datesubmitted": "2017-07-31 15:14:35"     },     {       "@id": "_:n81fa7118b0284a699cf7fa995272931d",       "@rdf:value": "https://hcommons.org/deposits/download/hc:12252/content/hd-51705-13.pdf/",       "@type": "uri"     },     {       "@id": "_:n87a1b8119dff4b1f98354c8593862abb",       "@rdf:path": "files/4/eisenstein és klein - 2015 - tome interactive topic model , metadata visuali.pdf"     },     {       "@bib:authors": {         "@id": "_:n8905b69040544969bc1c95d7dca2884c"       },       "@dc:date": "2015",       "@dc:identifier": {         "@id": "_:n76c5f49b8e884b578cb3c045dc1a70fd"       },       "@dc:title": "tome: interactive topic model , metadata visualization",       "@id": "https://hcommons.org/deposits/item/hc:12251/",       "@link:link": [         {           "@id": "file:///c://users/tamas/ideaprojects/szak/test/sample.rdf#item_4"         },         {           "@id": "file:///c://users/tamas/ideaprojects/szak/test/sample.rdf#item_5"         }       ],       "@type": "@bib:article",       "@zotero:itemtype": "journalarticle",       "@zotero:librarycatalog": "hcommons.org",       "@zotero:shorttitle": "tome",       "abstract": "as archives being digitized @ increasing rate, scholars require new tools make sense of expanding amount of material.  propose build tome, tool support interactive exploration , visualization of text-based archives.  drawing upon technique of topic modeling--a computational method identifying themes recur across collection--tome visualize topics characterize each archive, relationships between specific topics , related metadata, such publication date.  archive of 19th-century antislavery newspapers, characterized diverse authors , shifting political alliances, serve our initial dataset; promises motivate new methods visualizing topic models , extending impact.  in turn, applying our new methods these texts, illuminate how issues of gender , racial identity affect development of political ideology in nineteenth century, , present day.",       "ispartof": {         "@id": "_:n3be30b8c7e854c7faa70c82bb8123790"       }     },     {       "@id": "_:n8905b69040544969bc1c95d7dca2884c",       "@rdf:_1": {         "@id": "_:nf41dc31a25a8490bbf8b5f8dcf800f62"       },       "@rdf:_2": {         "@id": "_:nbc8e64428043427ab27b5beb15159fa3"       },       "@type": "@rdf:seq"     },     {       "@foat:givenname": "lauren frederica",       "@foat:surname": "klein",       "@id": "_:nbc8e64428043427ab27b5beb15159fa3",       "@type": "@foat:person"     },     {       "@foat:givenname": "jacob",       "@foat:surname": "eisenstein",       "@id": "_:nf41dc31a25a8490bbf8b5f8dcf800f62",       "@type": "@foat:person"     },     {       "@id": "_:n76c5f49b8e884b578cb3c045dc1a70fd",       "@rdf:value": "https://hcommons.org/deposits/item/hc:12251/",       "@type": "uri"     },     {       "@id": "_:n3be30b8c7e854c7faa70c82bb8123790",       "@type": "@bib:journal"     }   ] } 

i used node js json-ld module: https://github.com/digitalbazaar/jsonld.js

var context = {             "@context": {                 "@rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",                 "@zotero": "http://www.zotero.org/namespaces/export#",                 "@vocab": "http://purl.org/dc/terms/",                 "@bib": "http://purl.org/net/biblio#",                 "@foat": "http://xmlns.com/foaf/0.1/",                 "@link": "http://purl.org/rss/1.0/modules/link/",                 "@dc": "http://purl.org/dc/elements/1.1/",                 "@prism": "http://prismstandard.org/namespaces/1.2/basic/"             }         };          jsonld.frame(doc, context, function(err, framed) {             // document transformed particular tree structure per given frame             console.log(json.stringify(framed, null, 2));             fs.writefile('test/test_sample.json', json.stringify(framed, null, 2), 'utf8');         }); 

output test_sample.json:

{   "@context": {     "@rdf": "http://www.w3.org/1999/02/22-rdf-syntax-ns#",     "@zotero": "http://www.zotero.org/namespaces/export#",     "@vocab": "http://purl.org/dc/terms/",     "@bib": "http://purl.org/net/biblio#",     "@foat": "http://xmlns.com/foaf/0.1/",     "@link": "http://purl.org/rss/1.0/modules/link/",     "@dc": "http://purl.org/dc/elements/1.1/",     "@prism": "http://prismstandard.org/namespaces/1.2/basic/"   },   "@graph": [     {       "@id": "_:b0",       "@type": "uri",       "@rdf:value": "https://hcommons.org/deposits/item/hc:12251/"     },     {       "@id": "_:b1",       "@rdf:path": "files/5/hc12251.html"     },     {       "@id": "_:b2",       "@type": "uri",       "@rdf:value": "https://hcommons.org/deposits/download/hc:12252/content/hd-51705-13.pdf/"     },     {       "@id": "_:b3",       "@rdf:path": "files/4/eisenstein és klein - 2015 - tome interactive topic model , metadata visuali.pdf"     },     {       "@id": "_:b4",       "@type": "uri",       "@rdf:value": "https://hcommons.org/deposits/item/hc:12251/"     },     {       "@id": "_:b5",       "@type": "@bib:journal"     },     {       "@id": "_:b6",       "@type": "@rdf:seq",       "@rdf:_1": {         "@id": "_:b7",         "@type": "@foat:person",         "@foat:givenname": "jacob",         "@foat:surname": "eisenstein"       },       "@rdf:_2": {         "@id": "_:b8",         "@type": "@foat:person",         "@foat:givenname": "lauren frederica",         "@foat:surname": "klein"       }     },     {       "@id": "_:b7",       "@type": "@foat:person",       "@foat:givenname": "jacob",       "@foat:surname": "eisenstein"     },     {       "@id": "_:b8",       "@type": "@foat:person",       "@foat:givenname": "lauren frederica",       "@foat:surname": "klein"     },     {       "@id": "file:///c://users/tamas/ideaprojects/szak/test/sample.rdf#item_4",       "@type": "@zotero:attachment",       "@dc:identifier": {         "@id": "_:b2",         "@type": "uri",         "@rdf:value": "https://hcommons.org/deposits/download/hc:12252/content/hd-51705-13.pdf/"       },       "@dc:title": "full text pdf",       "datesubmitted": "2017-07-31 15:14:35",       "@link:type": "application/pdf",       "@rdf:path": {         "@id": "_:b3",         "@rdf:path": "files/4/eisenstein és klein - 2015 - tome interactive topic model , metadata visuali.pdf"       },       "@zotero:itemtype": "attachment",       "@zotero:linkmode": "1"     },     {       "@id": "file:///c://users/tamas/ideaprojects/szak/test/sample.rdf#item_5",       "@type": "@zotero:attachment",       "@dc:identifier": {         "@id": "_:b0",         "@type": "uri",         "@rdf:value": "https://hcommons.org/deposits/item/hc:12251/"       },       "@dc:title": "snapshot",       "datesubmitted": "2017-07-31 15:14:39",       "@link:type": "text/html",       "@rdf:path": {         "@id": "_:b1",         "@rdf:path": "files/5/hc12251.html"       },       "@zotero:itemtype": "attachment",       "@zotero:linkmode": "1"     },     {       "@id": "https://hcommons.org/deposits/item/hc:12251/",       "@type": "@bib:article",       "@dc:date": "2015",       "@dc:identifier": {         "@id": "_:b4",         "@type": "uri",         "@rdf:value": "https://hcommons.org/deposits/item/hc:12251/"       },       "@dc:title": "tome: interactive topic model , metadata visualization",       "abstract": "as archives being digitized @ increasing rate, scholars require new tools make sense of expanding amount of material.  propose build tome, tool support interactive exploration , visualization of text-based archives.  drawing upon technique of topic modeling--a computational method identifying themes recur across collection--tome visualize topics characterize each archive, relationships between specific topics , related metadata, such publication date.  archive of 19th-century antislavery newspapers, characterized diverse authors , shifting political alliances, serve our initial dataset; promises motivate new methods visualizing topic models , extending impact.  in turn, applying our new methods these texts, illuminate how issues of gender , racial identity affect development of political ideology in nineteenth century, , present day.",       "ispartof": {         "@id": "_:b5",         "@type": "@bib:journal"       },       "@bib:authors": {         "@id": "_:b6",         "@type": "@rdf:seq",         "@rdf:_1": {           "@id": "_:b7",           "@type": "@foat:person",           "@foat:givenname": "jacob",           "@foat:surname": "eisenstein"         },         "@rdf:_2": {           "@id": "_:b8",           "@type": "@foat:person",           "@foat:givenname": "lauren frederica",           "@foat:surname": "klein"         }       },       "@link:link": [         {           "@id": "file:///c://users/tamas/ideaprojects/szak/test/sample.rdf#item_4",           "@type": "@zotero:attachment",           "@dc:identifier": {             "@id": "_:b2",             "@type": "uri",             "@rdf:value": "https://hcommons.org/deposits/download/hc:12252/content/hd-51705-13.pdf/"           },           "@dc:title": "full text pdf",           "datesubmitted": "2017-07-31 15:14:35",           "@link:type": "application/pdf",           "@rdf:path": {             "@id": "_:b3",             "@rdf:path": "files/4/eisenstein és klein - 2015 - tome interactive topic model , metadata visuali.pdf"           },           "@zotero:itemtype": "attachment",           "@zotero:linkmode": "1"         },         {           "@id": "file:///c://users/tamas/ideaprojects/szak/test/sample.rdf#item_5",           "@type": "@zotero:attachment",           "@dc:identifier": {             "@id": "_:b0",             "@type": "uri",             "@rdf:value": "https://hcommons.org/deposits/item/hc:12251/"           },           "@dc:title": "snapshot",           "datesubmitted": "2017-07-31 15:14:39",           "@link:type": "text/html",           "@rdf:path": {             "@id": "_:b1",             "@rdf:path": "files/5/hc12251.html"           },           "@zotero:itemtype": "attachment",           "@zotero:linkmode": "1"         }       ],       "@zotero:itemtype": "journalarticle",       "@zotero:librarycatalog": "hcommons.org",       "@zotero:shorttitle": "tome"     }   ] } 


Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -