lincd
Version:
LINCD is a JavaScript library for building user interfaces with linked data (also known as 'structured data', or RDF)
44 lines (43 loc) • 1.57 kB
TypeScript
import { NodeSet } from '../collections/NodeSet.js';
import { BlankNode, NamedNode, Node } from '../models.js';
import { Shape } from './Shape.js';
/**
* Class to work with rdf Lists
* A list is a way to store an ORDERED array in RDF (so in the graph with triples)
* For example:
* person.location = ["Portugal","Bali"]
* If the order of these 2 items matters then it can be stored as a list in the graph like this:
* _:somePerson _:location _:list1
* _:list1 rdf:first "Portugal"
* _:list1 rdf:rest _:list2 <-- continuation of the list can be found here
* _:list2 rdf:first "Bali"
* _:list2 rdf:rest rdf:nil <-- end of the list
*
*/
export declare class List extends Shape {
static targetClass: NamedNode;
constructor(blanknode?: BlankNode);
/**
* Create a new list from a given set of nodes
* Most performant way to create a new list if you already have the items in the list
* @param items
*/
static createFrom(items: NodeSet | Node[], isTemporaryNode?: boolean): List;
/**
* Returns the contents of a rdf.List
* Will return an empty set if the given node is not a list
* @param list
* @param result
* @private
*/
static getContents(list: NamedNode, result?: NodeSet<Node>): NodeSet;
private static getFirstItem;
private static appendItems;
private static getLastListItem;
private static _createListEntry;
private static _append;
getContents(): NodeSet<Node>;
isEmpty(): boolean;
addItem(item: Node): void;
addItems(items: NodeSet | Node[]): void;
}