ilusm.dev

kg

Knowledge graphs, RDF, SPARQL, graph databases, reasoning.

Load with: use kg

Quick example

use kg

result = kgne(10)
prn(result)

Functions

Graph

kgne(nm)

Creates a new instance. Takes nm.

Namespaces

kgns(kg, pre, uri)

Performs the operation. Takes kg, pre, uri.

kgxpn(kg, curie)

Performs the operation. Takes kg, curie.

Triples

kgtrp(s, p, o)

Performs the operation. Takes s, p, o.

kgadd(kg, s, p, o)

Performs the operation. Takes kg, s, p, o.

kgddr(kg, trps)

Performs the operation. Takes kg, trps.

Query

kgqry(kg, pat)

Performs the operation. Takes kg, pat.

kgsbj(kg, s)

Performs the operation. Takes kg, s.

kgobj(kg, o)

Performs the operation. Takes kg, o.

kgprd(kg, p)

Reads data. Takes kg, p.

SPARQL-like queries

kgspr(kg, q)

Processes or prints. Takes kg, q.

Basic graph patterns

kgbgp(kg, bgp)

Performs the operation. Takes kg, bgp.

RDF serialization

kg2rd(kg)

Reads data. Takes kg.

kg2tr(kg)

Performs the operation. Takes kg.

kg2nt(kg)

Performs the operation. Takes kg.

kg2js(kg)

Performs the operation. Takes kg.

RDF parsing

kgfr0(s)

Performs the operation. Takes s.

kgfr1(s)

Performs the operation. Takes s.

kgfr3(s)

Performs the operation. Takes s.

kgfrm(j)

Removes an item. Takes j.

OWL/RDFS reasoning

kgnfr(kg)

Creates from another format. Takes kg.

OWL constructs

kgcls(nm)

Lists items. Takes nm.

kgprp(nm, dom, rng)

Performs the operation. Takes nm, dom, rng.

kgsbc(sub, sup)

Performs the operation. Takes sub, sup.

kgsbp(sub, sup)

Performs the operation. Takes sub, sup.

kgnst(nm, cls)

Sets a value or starts a process. Takes nm, cls.

SHACL validation

kgshc(kg, shp)

Performs the operation. Takes kg, shp.

Graph algorithms

kgtrv(kg, st, mode)

Performs the operation. Takes kg, st, mode.

kgcnn(kg, a, b)

Performs the operation. Takes kg, a, b.

kgpth(kg, a, b, mode)

Performs the operation. Takes kg, a, b, mode.

Centrality

kgbtw(kg)

Performs the operation. Takes kg.

kgpgr(kg, damp, iters)

Performs the operation. Takes kg, damp, iters.

Clustering

kgcmm(kg)

Performs the operation. Takes kg.

kgcl0(kg, k)

Performs the operation. Takes kg, k.

Similarity

kgsim(kg, a, b, mode)

Performs the operation. Takes kg, a, b, mode.

Graph database connection

kgn4j(url, usr, pwd)

Performs the operation. Takes url, usr, pwd.

kgncy(neo, q)

Performs the operation. Takes neo, q.

kgrn0(url, db)

Performs the operation. Takes url, db.

kgrng(ar, q)

Performs the operation. Takes ar, q.

Wikidata/DBpedia queries

kgwkd(q)

Performs the operation. Takes q.

Schema.org helpers

kgsch(typ)

Checks a condition. Takes typ.

Property paths

kgseq(p1, p2)

Performs the operation. Takes p1, p2.

kgalt(p1, p2)

Performs the operation. Takes p1, p2.

kgstr(p)

Performs the operation. Takes p.

Named graphs

kgnmd(kg, nm)

Performs the operation. Takes kg, nm.

kgctx(kg, ctx)

Performs the operation. Takes kg, ctx.

Provenance

kgprv(trp, agt, act, tm)

Performs the operation. Takes trp, agt, act, tm.

Import/export to graph formats

kg2gm(kg)

Performs the operation. Takes kg.

kg2gx(kg)

Performs the operation. Takes kg.

kg2gr(kg)

Performs the operation. Takes kg.

kgfr2(s)

Performs the operation. Takes s.

Notes

  • Knowledge graph - nodes, edges, RDF-style triples.