GithubHelp home page GithubHelp logo

tree-metadata-extraction's Introduction

TREE metadata extraction

This library handles the extraction of TREE metadata from RDF data.

Installation

Node

const extractMetadata = require('@treecg/tree-metadata-extraction').extractMetadata

typescript

import { extractMetadata } from '@treecg/tree-metadata-extraction';

Usage

// quads is an array of RDF Quads (RDF.Quad[])
const metadata = extractMetadata(quads)

// Retrieve extracted collections metadata
for (const collectionId of metadata.collections.keys()) {
  const collection = metadata.collections.get(collectionId)
}

// Retrieve extracted nodes metadata
for (const nodeId of metadata.nodes.keys()) {
  const node = metadata.nodes.get(nodeId)
}

// Retrieve extracted relations metadata
for (const relationId of metadata.relations.keys()) {
  const relation = metadata.relations.get(relationId)
}

Extracted metadata

In this section, the extracted fields per class are listed. In the case an Object is returned, it can have arbitrary fields that are not listed below.

Object Metadata field type referenced object type
Collection @id string
@type [ string ]
view [ URI ] Node
member [ URI ] Member
shape [ Shape ]
totalItems [ Literal ]
import [ URI ]
importStream [ URI ]
conditionalImport [ ConditionalImport ]
... [ any ]
Node @id string
@type [ string ]
relation [ URI ] Relation
search [ object ]
retentionPolicy [ RetentionPolicy ]
import [ object ]
importStream [ object ]
conditionalImport [ ConditionalImport ]
... [ any ]
Relation @id string
@type [ string ]
remainingItems [ Literal ]
path [ object ] shacl:propertyPath
value [ object ]
node [ URI ] Node
import [ URI ]
importStream [ URI ]
conditionalImport [ ConditionalImport ]
Member ... [ any ]
Shape ... [ any ] shacl:NodeShape / shex:Shape
IriTemplate ... [ any ] hydra:IriTemplate
ConditionalImport path [ object ] shacl:propertyPath
import [ URI ]
importStream [ URI ]
RetentionPolicy @type [ string ]
amount [ Literal ]
versionKey [ object ]
path [ object ] shacl:propertyPath
value [ object ]
Literal @value [ string ]
@type [ string ]
@language [ string ]
URI @id string
object @id string
... [ any ]
Note: Blank node URIs can be returned as a URI. 
We expect any additional data used in combination with the extracted metadata to be retrieved from the same rdfjs data factory.

Examples

Retrieve the ids of all members of all collections available in the quad array.

// Parse the input into a quad array
const quads = parse(input)

// Extract the tree metadata from the quad array
const metadata = extractMetadata(quads)

const memberIds = []

// Retrieve extracted collections metadata
for (const collectionId of metadata.collections.keys()) {
  // Get the collection object
  const collection = metadata.collections.get(collectionId)
  // Map the member URIs to extract the @id values
  const memberURIs = collection.member.map(uri => uri["@id"])
  // Store the @id values
  memberIds = memberIds.concat(memberURIs)
}

return memberIds

tree-metadata-extraction's People

Contributors

dexagod avatar hdelva avatar pietercolpaert avatar

Watchers

James Cloos avatar  avatar

Forkers

pietercolpaert

tree-metadata-extraction's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.