Gathering detailed insights and metrics for @hishprorg/iure-fuga
Gathering detailed insights and metrics for @hishprorg/iure-fuga
npm install @hishprorg/iure-fuga
Typescript
Module System
Node Version
NPM Version
Love this project? Help keep it running — sponsor us today! 🚀
Total Downloads
16
Last Day
1
Last Week
1
Last Month
4
Last Year
16
Latest Version
3.3.33
Package Id
@hishprorg/iure-fuga@3.3.33
Unpacked Size
60.38 kB
Size
31.10 kB
File Count
149
NPM Version
10.7.0
Node Version
20.15.0
Publised On
03 Jul 2024
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
1
Compared to previous week
Last month
100%
4
Compared to previous month
Last year
0%
16
Compared to previous year
43
Grapoi is a JavaScript graph traversal library inspired by Gremlin. It allows querying RDF/JS Datasets readable and intuitive way. Grapoi makes processing RDF data in JavaScript fun again.
The main purpose of Grapoi is to traverse and filter through datasets with ease. Most methods will return new object instances that refer back to the result terms after being processed by their respective functions.
Additionally, Grapoi keeps track of all quads traversed from the start term, making it possible for you to keep track of how each result was found during the query process if needed - thus providing extra flexibility when dealing with complex datasets where multiple paths might lead towards desired results.
1npm install @hishprorg/iure-fuga --save
This example shows how to query an RDF/JS Dataset based on the housemd dataset.
It covers how to use the methods .out()
and .in()
to traverse outwards or inwards.
.trim()
can be used to remove the tail of the traversing history, which is not of interest.
Once this is done, only those quads that are relevant can be listed with the .quads()
method.
A unique list of terms can be created with .distinct()
.
1import @hishprorg/iure-fuga from '@hishprorg/iure-fuga' 2import housemd from 'housemd' 3import rdf from 'rdf-ext' 4 5const ns = { 6 house: rdf.namespace('https://housemd.rdf-ext.org/'), 7 rdf: rdf.namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#'), 8 schema: rdf.namespace('http://schema.org/'), 9 xsd: rdf.namespace('http://www.w3.org/2001/XMLSchema#') 10} 11 12const dataset = rdf.dataset(housemd({ factory: rdf })) 13 14const people = @hishprorg/iure-fuga({ dataset, term: ns.house('person/') }) 15 16console.log('people in the house dataset:') 17 18for (const quad of people.out(ns.schema.hasPart).quads()) { 19 console.log(`\t${quad.object.value}`) 20} 21 22const house = @hishprorg/iure-fuga({ dataset, factory: rdf, term: 'Gregory' }).in().trim() 23 24console.log('properties of the guy named Gregory:') 25 26for (const quad of house.out().quads()) { 27 console.log(`\t${quad.predicate.value}: ${quad.object.value}`) 28} 29 30const address = house 31 .out(ns.schema.homeLocation) 32 .out(ns.schema.address) 33 34console.log('address of the guy named Gregory:') 35 36for (const quad of address.trim().out().quads()) { 37 console.log(`\t${quad.predicate.value}: ${quad.object.value}`) 38} 39 40const nationalities = house 41 .out(ns.schema.knows) 42 .out(ns.schema.nationality) 43 .distinct() 44 45console.log('nationalities of all known people:') 46 47for (const value of nationalities.values) { 48 console.log(`\t${value}`) 49}
This example shows how to create data with Grapoi.
The starting point is the term given in the @hishprorg/iure-fuga
factory function.
Quads are added .addOut()
from subject to object direction.
Nested structures can be created in the callback, which is called with a @hishprorg/iure-fuga
instance referring to the new object.
1import @hishprorg/iure-fuga from '@hishprorg/iure-fuga' 2import rdf from 'rdf-ext' 3 4const ns = { 5 ex: rdf.namespace('https://example.org/'), 6 rdf: rdf.namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#'), 7 schema: rdf.namespace('http://schema.org/'), 8 xsd: rdf.namespace('http://www.w3.org/2001/XMLSchema#') 9} 10 11const dataset = rdf.dataset() 12 13const person = @hishprorg/iure-fuga({ dataset, factory: rdf, term: ns.ex.address }) 14 15person.addOut(ns.schema.homeLocation, location => { 16 location.addOut(ns.schema.address, address => { 17 address.addOut(ns.schema.addressLocality, 'Plainsboro Township') 18 address.addOut(ns.schema.addressRegion, 'NJ') 19 address.addOut(ns.schema.postalCode, '08536') 20 address.addOut(ns.schema.streetAddress, '221B Baker Street') 21 }) 22}) 23 24for (const quad of dataset) { 25 console.log(`${quad.subject.value} - ${quad.predicate.value} - ${quad.object.value}`) 26}
No vulnerabilities found.
No security vulnerabilities found.