sparnatural
Version:
Visual client-side SPARQL query builder and knowledge graph exploration tool
98 lines (97 loc) • 4.57 kB
TypeScript
import { Quad_Object, Quad_Predicate, Quad_Subject, Term } from "@rdfjs/types/data-model";
import { RdfStore } from "rdf-stores";
export declare class StoreModel {
protected store: RdfStore;
constructor(n3store: RdfStore);
static getLocalName(uri: string): string;
/**
* Reads the given property on an entity, and return values as an array
**/
readProperty(subject: Term, property: Term): Quad_Object[];
/**
* Reads the given property on an entity recursively, and return values as an array
**/
readPropertyRec(subject: Term, property: Term): Quad_Object[];
/**
* Reads the given property on an entity, and returns the first value found, or undefined if not found
**/
readSingleProperty(subject: Term, property: Term): Term | undefined;
/**
* Reads the given property on an entity, and returns the first value found cast to Number
**/
readSinglePropertyAsNumber(subject: Term, property: Term): number | undefined;
/**
* Finds all subjects having the given property with the given object, or undefined if not found
**/
findSubjectsOf(property: Term, object: Term): Quad_Subject[];
/**
* Finds the subjects having the given property with the given object, and returns the first value found, or undefined if not found
*/
findSingleSubjectOf(property: Term, object: Term): Quad_Subject | undefined;
readPropertyInLang(subject: Term, property: Term, lang: string, defaultToNoLang?: boolean): Term[];
/**
* Reads the given property on an entity, and returns the first value found, or undefined if not found
**/
readSinglePropertyInLang(subject: Term, property: Term, lang: string, defaultToNoLang?: boolean): Term | undefined;
size(): number;
hasProperty(subject: Quad_Subject, property: Quad_Predicate): boolean;
hasTriple(rdfNode: Quad_Subject, property: Quad_Predicate, value: Quad_Object | null): boolean;
findSubjectsWithPredicate(property: Term, rdfNode: Term): Term[];
/****** LIST HANDLING ********/
listContains(rdfNode: any, propertyList: any, property: any, value: any): boolean;
/**
* returns RDFTerms
*/
readAsList(rdfNode: any, property: any): Term[];
/**
* returns RDFTerms
*/
readListContent(list: Term): Term[];
readRootList(listId: any): any;
readSuperList(listId: any): Quad_Subject;
/******* END LIST HANDLING *********/
/**
* Finds the most suitable value of a given property for a list of languages.
* Falls back to literals with no language if no better literal is found.
* @param subject The subject resource.
* @param langs The allowed languages.
* @param properties The properties to check.
* @return The best suitable value or null.
*/
getBestStringLiteral(subject: Term, langs: string[], properties: Term[]): Term | null;
/**
* Render a list of RDFNode as a string, in plain text.
* @param list The list of RDFNode to be displayed.
* @return A comma-separated string.
*/
static render(list: Term[]): string;
/**
* Render an RDFNode as a string, in plain text.
* @param node The node to be rendered.
* @return The rendered string.
*/
static renderNode(node: Term): string;
/**
* Render a list of RDFNode as a comma-separated string. If plainString is true, make it a plain string,
* otherwise uses HTML markup to display e.g. datatypes and languages in "sup" tags.
* @param list The list of RDFNode to be displayed.
* @param plainString True to retrieve a plain string, false to retrieve a piece of HTML.
* @return The rendered string.
*/
static renderWithPlainString(list: Term[], plainString: boolean): string;
/**
* Render an RDFNode as a string. If plainString is true, make it a plain string,
* otherwise uses HTML markup to display e.g. datatypes and languages in "sup" tags.
* @param node The node to be rendered.
* @param plainString True to retrieve a plain string, false to retrieve a piece of HTML.
* @return The rendered string.
*/
static renderSingleNode(node: Term, plainString: boolean): string;
/**
* Renders the provided SHACL property path as a SPARQL property path syntax, using prefixed URIs.
* @param path The SHACL property path to render in SPARQL.
* @param usePrefixes True to use prefixes, false to use full URIs.
* @return The rendered SPARQL property path.
*/
pathToSparql(path: Term, usePrefixes?: boolean): string;
}