5.5.74 • Published 11 months ago

@diotoborg/illum-ad-corporis v5.5.74

Weekly downloads
-
License
MIT
Repository
github
Last release
11 months ago

@diotoborg/illum-ad-corporis

build status npm version

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.

Install

npm install @diotoborg/illum-ad-corporis --save

Usage

Query Data

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().

import @diotoborg/illum-ad-corporis from '@diotoborg/illum-ad-corporis'
import housemd from 'housemd'
import rdf from 'rdf-ext'

const ns = {
  house: rdf.namespace('https://housemd.rdf-ext.org/'),
  rdf: rdf.namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#'),
  schema: rdf.namespace('http://schema.org/'),
  xsd: rdf.namespace('http://www.w3.org/2001/XMLSchema#')
}

const dataset = rdf.dataset(housemd({ factory: rdf }))

const people = @diotoborg/illum-ad-corporis({ dataset, term: ns.house('person/') })

console.log('people in the house dataset:')

for (const quad of people.out(ns.schema.hasPart).quads()) {
  console.log(`\t${quad.object.value}`)
}

const house = @diotoborg/illum-ad-corporis({ dataset, factory: rdf, term: 'Gregory' }).in().trim()

console.log('properties of the guy named Gregory:')

for (const quad of house.out().quads()) {
  console.log(`\t${quad.predicate.value}: ${quad.object.value}`)
}

const address = house
  .out(ns.schema.homeLocation)
  .out(ns.schema.address)

console.log('address of the guy named Gregory:')

for (const quad of address.trim().out().quads()) {
  console.log(`\t${quad.predicate.value}: ${quad.object.value}`)
}

const nationalities = house
  .out(ns.schema.knows)
  .out(ns.schema.nationality)
  .distinct()

console.log('nationalities of all known people:')

for (const value of nationalities.values) {
  console.log(`\t${value}`)
}

Create Data

This example shows how to create data with Grapoi. The starting point is the term given in the @diotoborg/illum-ad-corporis factory function. Quads are added .addOut() from subject to object direction. Nested structures can be created in the callback, which is called with a @diotoborg/illum-ad-corporis instance referring to the new object.

import @diotoborg/illum-ad-corporis from '@diotoborg/illum-ad-corporis'
import rdf from 'rdf-ext'

const ns = {
  ex: rdf.namespace('https://example.org/'),
  rdf: rdf.namespace('http://www.w3.org/1999/02/22-rdf-syntax-ns#'),
  schema: rdf.namespace('http://schema.org/'),
  xsd: rdf.namespace('http://www.w3.org/2001/XMLSchema#')
}

const dataset = rdf.dataset()

const person = @diotoborg/illum-ad-corporis({ dataset, factory: rdf, term: ns.ex.address })

person.addOut(ns.schema.homeLocation, location => {
  location.addOut(ns.schema.address, address => {
    address.addOut(ns.schema.addressLocality, 'Plainsboro Township')
    address.addOut(ns.schema.addressRegion, 'NJ')
    address.addOut(ns.schema.postalCode, '08536')
    address.addOut(ns.schema.streetAddress, '221B Baker Street')
  })
})

for (const quad of dataset) {
  console.log(`${quad.subject.value} - ${quad.predicate.value} - ${quad.object.value}`)
}
schemaexecrfc9562Object.definePropertytoReversedtypescriptresolvechineseutilpolyfilltypelesslengtharrayseventEmittersharedesRegExp#flagsloglanguagePushInt16Arrayflagroute53tc39ECMAScript 2019ECMAScript 2023frameremrconstcloneerror-handlinginterruptsjsforkeslintconfigdeep-clonetostringtagcompilergitignoreESebsstoragegatewaypropertydataViewPromiseES2015comparea11yvalidatorspringtrimRightphoneclassnameslruformattingsetminimalRegExp.prototype.flagsdeepclonespinnerasteriskselasticachefunctionalBigInt64ArrayargumentdeterministicsidegroupWeakSetlogginglibphonenumberreplaySymbol.toStringTagecmascripttoStringTagSymbolpostcsses2015ttyArray.prototype.findLastIndexgetOwnPropertyDescriptorbrowserobjfigletECMAScript 2021sortairbnbloggerArrayBuffer#sliceworkflowdiffstatecallbindmacosinvariantmulti-packagees2018clientHyBies6argvtypanionjsonschemaperformantclass-validatorlockfileartstringifyiteratores-shim APIextendbrowserlistisConcatSpreadableInt32Arraywindowregexpersistentcheckcloudsearchstreamsescapecall-boundES7json-schemavalidatehookformTypeBoxcontainsfindLastIndexJSONnopefunctionspawnassertionastfullchaikeypostcss-pluginchromesqsimmerweakset$.extendquerystringkinesisURLprettymapvaluesprotoelectronrulesflattencollection.es6operating-systemdeepcopyjQueryfilterqueueMicrotaskhasOwnglobal this valueestreevpcjsdomtsnegative zeroformatWebSocketasciiproptypedarrayscodesmake dirpreprocessorrangeerrorrequireregexplinkstylingchannelstreamlocaltypesafeutil.inspectECMAScript 3listenersshrinkwrapthreefast-deep-cloneprotobufbabel-coreECMAScript 2020readablegetintrinsic0certificatescoerciblecurriedrfc4122pnpm9errorclitoSortedoutput6to5hardlinkstoobjectargsvarsponyfillWebSocketsECMAScript 2017arktypespecreacthelpertelephonenegativeArray.prototype.filterenvironmentsymlinkMapreadablestreamrgbES2023Int8ArrayemitshellregularfpvariablesECMAScript 6consumeglobal objecttrimLeftprefixes5zodwhatwgajaxES6fastcopyzeropreserve-symlinksStreamsreduceiterate256toolsdirawesomesaucesetterinpackage managerselfgdproptimistsetPrototypeOfharmonyposeES2017json-schema-validatores-abstractpackagesstringifierfluxtyped arraydateimportjoivestbundlingArray.prototype.findLastswftypeerrorreact-hook-formtraversesignalscallyamlproxyfromjson-schema-validationjsonsuperstructes2016dropdotenvUint32ArrayintrinsiccsseventDispatcherjavascriptObject.assignreact-hooksreal-timepatchgroupByinputglobalThismanageramazonregular expressionsigtermbddshebangbindformsschemeobjectworkerArray.prototype.includesimmutablestylesparsergradients cssfunction.lengthbootstrap cssserializerdescriptorutilstranspileformscheme-validationURLSearchParamsqueuematchajvArray.prototype.containstextnodejsless.jsmatchesstablextermcloudtraildescriptorstestconcatMaptddflatMaprequestroutingArray.prototype.flatfullwidthagentES2020importexportequalitysuperagenthascall-bindpredictableeslintcss lessdataFloat32ArrayequalglacierObject.entriess3cryptdeletepasswordmkdirppropertiesstylesheettestingexpressautoprefixercolumnssetImmediateexecfilerobustec2ES2019reverseinternal slotgesturesclassnameanimationfindutilities-0System.globalMicrosoftfast-copyspeedtimevarsyntaxerrorcloudfrontsharedarraybufferreact animationawsl10nruntimewhichauthrapidterminalreact-componentcolorsbundlertranspilergetpromisecreatereversedenumerableArray.prototype.flatMapStyleSheetcollectionmonorepopathparsingdefinePropertyrouteFunction.prototype.namesymlinksfnmatchwritehotfull-widthfsserializationparse[[Prototype]]less compilerstyled-componentspluginlastsameValueZeroexit-codedynamodbes2017asynccjkinstallECMAScriptcryptovisualredactcolumnuuid.gitignoreprivatehooksbufferreact-testing-libraryslotnumberurlwaapifetchbyteLengthbeanstalkencryptionunicodestatelessES2021ECMAScript 2018findLastextrapopmotionuninstallarrayeast-asian-widthstringless cssgraphqloptionAsyncIteratores8globalsmixinstypesconcatprototypetypedarraytrimEndfastcloneutilityObjectCSSbrowserslistaccessorTypeScriptownredux-toolkitReactiveXmapreduceECMAScript 2022pinofile systemes-shimsflagsboundflat__proto__loadingdeepnested csslesscssECMAScript 5reduxeslintpluginES8fast-clonemodulesjwtfastifynpmignorebannermkdirsObservableapollocolorstarterbusyfunctionstransportchildreact poseStreamYAMLnamesarraybufferassign
5.5.74

11 months ago

5.5.73

11 months ago

4.5.73

11 months ago

4.5.72

11 months ago

4.5.71

11 months ago

4.5.70

11 months ago

4.5.69

11 months ago

4.5.68

11 months ago

4.5.67

11 months ago

4.5.66

11 months ago

3.5.66

11 months ago

2.5.66

11 months ago

2.5.65

11 months ago

2.5.64

11 months ago

2.5.63

11 months ago

2.5.62

11 months ago

2.5.61

11 months ago

2.5.60

11 months ago

2.5.59

11 months ago

2.5.58

11 months ago

2.5.57

11 months ago

2.5.56

11 months ago

2.5.55

11 months ago

2.5.54

11 months ago

2.5.53

11 months ago

2.5.52

11 months ago

2.5.51

12 months ago

2.4.51

12 months ago

2.4.50

12 months ago

2.4.49

12 months ago

2.4.48

12 months ago

2.4.47

12 months ago

2.4.46

12 months ago

1.4.46

12 months ago

1.4.45

12 months ago

1.4.44

12 months ago

1.4.43

12 months ago

1.4.42

12 months ago

1.4.41

12 months ago

1.4.40

12 months ago

1.4.39

12 months ago

1.4.38

12 months ago

1.4.37

12 months ago

1.4.36

12 months ago

1.3.36

12 months ago

1.3.35

12 months ago

1.3.34

1 year ago

1.3.33

1 year ago

1.3.32

1 year ago

1.3.31

1 year ago

1.2.31

1 year ago

1.2.30

1 year ago

1.2.29

1 year ago

1.2.28

1 year ago

1.2.27

1 year ago

1.2.26

1 year ago

1.1.26

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago