mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
rdf-js: remove triples (#43914)
* remove triples Triples are not specified in the RDF/JS standards. * bump major version * expand the argument type of `Quad.equals`
This commit is contained in:
parent
16a56ae606
commit
72ccd00994
2
types/n3/index.d.ts
vendored
2
types/n3/index.d.ts
vendored
@ -100,7 +100,7 @@ export class Quad extends BaseQuad implements RDF.Quad {
|
||||
toJSON(): string;
|
||||
}
|
||||
|
||||
export class Triple extends Quad implements RDF.Triple {}
|
||||
export class Triple extends Quad implements RDF.Quad {}
|
||||
|
||||
export namespace DataFactory {
|
||||
function namedNode(value: string): NamedNode;
|
||||
|
||||
@ -178,7 +178,7 @@ function static_Triple_fromBaseTerms(): Quad {
|
||||
const predicate: NamedNode = <any> {};
|
||||
const object: NamedNode = <any> {};
|
||||
|
||||
return rdf.triple(subject, predicate, object);
|
||||
return rdf.quad(subject, predicate, object);
|
||||
}
|
||||
|
||||
function instance_Quad_fromBaseTerms(): Quad {
|
||||
@ -197,7 +197,7 @@ function instance_Triple_fromBaseTerms(): Quad {
|
||||
const predicate: NamedNode = <any> {};
|
||||
const object: NamedNode = <any> {};
|
||||
|
||||
return factory.triple(subject, predicate, object);
|
||||
return factory.quad(subject, predicate, object);
|
||||
}
|
||||
|
||||
function Quad_toJSON(): boolean {
|
||||
|
||||
27
types/rdf-js/index.d.ts
vendored
27
types/rdf-js/index.d.ts
vendored
@ -1,4 +1,4 @@
|
||||
// Type definitions for the RDFJS specification 2.0
|
||||
// Type definitions for the RDFJS specification 3.0
|
||||
// Project: https://github.com/rdfjs/representation-task-force
|
||||
// Definitions by: Ruben Taelman <https://github.com/rubensworks>
|
||||
// Laurens Rietveld <https://github.com/LaurensRietveld>
|
||||
@ -200,7 +200,7 @@ export interface BaseQuad {
|
||||
* @param other The term to compare with.
|
||||
* @return True if and only if the argument is a) of the same type b) has all components equal.
|
||||
*/
|
||||
equals(other: BaseQuad): boolean;
|
||||
equals(other: BaseQuad | null | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -232,19 +232,11 @@ export interface Quad extends BaseQuad {
|
||||
* @param other The term to compare with.
|
||||
* @return True if and only if the argument is a) of the same type b) has all components equal.
|
||||
*/
|
||||
equals(other: BaseQuad): boolean;
|
||||
equals(other: BaseQuad | null | undefined): boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* An RDF triple, containing the subject, predicate, object terms.
|
||||
*
|
||||
* Triple is an alias of Quad.
|
||||
*/
|
||||
// tslint:disable-next-line no-empty-interface
|
||||
export interface Triple extends Quad {}
|
||||
|
||||
/**
|
||||
* A factory for instantiating RDF terms, triples and quads.
|
||||
* A factory for instantiating RDF terms and quads.
|
||||
*/
|
||||
export interface DataFactory<OutQuad extends BaseQuad = Quad, InQuad extends BaseQuad = OutQuad> {
|
||||
/**
|
||||
@ -288,17 +280,6 @@ export interface DataFactory<OutQuad extends BaseQuad = Quad, InQuad extends Bas
|
||||
*/
|
||||
defaultGraph(): DefaultGraph;
|
||||
|
||||
/**
|
||||
* @param subject The triple subject term.
|
||||
* @param predicate The triple predicate term.
|
||||
* @param object The triple object term.
|
||||
* @return A new instance of Quad with `Quad.graph` set to DefaultGraph.
|
||||
* @see Quad
|
||||
* @see Triple
|
||||
* @see DefaultGraph
|
||||
*/
|
||||
triple(subject: InQuad['subject'], predicate: InQuad['predicate'], object: InQuad['object']): InQuad;
|
||||
|
||||
/**
|
||||
* @param subject The quad subject term.
|
||||
* @param predicate The quad predicate term.
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
import { BlankNode, DataFactory, Dataset, DatasetCore, DatasetCoreFactory, DatasetFactory, DefaultGraph, Literal,
|
||||
NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Triple, Term, Variable, Quad_Graph } from "rdf-js";
|
||||
NamedNode, Quad, BaseQuad, Sink, Source, Store, Stream, Term, Variable, Quad_Graph } from "rdf-js";
|
||||
import { EventEmitter } from "events";
|
||||
|
||||
function test_terms() {
|
||||
@ -55,14 +55,6 @@ function test_quads() {
|
||||
const o1: Term = quad.object;
|
||||
const g1: Term = quad.graph;
|
||||
quad.equals(quad);
|
||||
|
||||
const triple: Triple = quad;
|
||||
const s2: Term = triple.subject;
|
||||
const p2: Term = triple.predicate;
|
||||
const o2: Term = triple.object;
|
||||
const g2: Term = triple.graph;
|
||||
triple.equals(quad);
|
||||
quad.equals(triple);
|
||||
}
|
||||
|
||||
function test_datafactory() {
|
||||
@ -80,7 +72,6 @@ function test_datafactory() {
|
||||
const variable: Variable = dataFactory.variable ? dataFactory.variable('v1') : <any> {};
|
||||
|
||||
const term: NamedNode = <any> {};
|
||||
const triple: Quad = dataFactory.triple(term, term, term);
|
||||
interface QuadBnode extends BaseQuad {
|
||||
subject: Term;
|
||||
predicate: Term;
|
||||
|
||||
@ -8,5 +8,5 @@ const variable: RDF.Variable = rdf.variable('foo');
|
||||
const graph: RDF.DefaultGraph = rdf.defaultGraph();
|
||||
const defaultGraph: RDF.DefaultGraph = rdf.defaultGraphInstance;
|
||||
const namedNode: RDF.NamedNode = rdf.namedNode('foo');
|
||||
const triple: RDF.Triple = rdf.triple(namedNode, variable, literal);
|
||||
const triple: RDF.Quad = rdf.quad(namedNode, variable, literal);
|
||||
const quad: RDF.Quad = rdf.quad(namedNode, variable, literal, graph);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user