Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The DataFactory interface is missing the fromTerm and fromQuad methods #45

Open
matthieubosquet opened this issue Sep 9, 2024 · 3 comments

Comments

@matthieubosquet
Copy link
Contributor

The RDF/JS spec defines two methods fromTerm and fromQuad that are missing from the interface definition in this package.

Is it intentional?

Interface definition in @rdfjs/types:

types/data-model.d.ts

Lines 239 to 290 in ec006f7

export interface DataFactory<OutQuad extends BaseQuad = Quad, InQuad extends BaseQuad = OutQuad> {
/**
* @param value The IRI for the named node.
* @return A new instance of NamedNode.
* @see NamedNode
*/
namedNode<Iri extends string = string>(value: Iri): NamedNode<Iri>;
/**
* @param value The optional blank node identifier.
* @return A new instance of BlankNode.
* If the `value` parameter is undefined a new identifier
* for the blank node is generated for each call.
* @see BlankNode
*/
blankNode(value?: string): BlankNode;
/**
* @param value The literal value.
* @param languageOrDatatype The optional language or datatype.
* If `languageOrDatatype` is a NamedNode,
* then it is used for the value of `NamedNode.datatype`.
* Otherwise `languageOrDatatype` is used for the value
* of `NamedNode.language`.
* @return A new instance of Literal.
* @see Literal
*/
literal(value: string, languageOrDatatype?: string | NamedNode): Literal;
/**
* This method is optional.
* @param value The variable name
* @return A new instance of Variable.
* @see Variable
*/
variable?(value: string): Variable;
/**
* @return An instance of DefaultGraph.
*/
defaultGraph(): DefaultGraph;
/**
* @param subject The quad subject term.
* @param predicate The quad predicate term.
* @param object The quad object term.
* @param graph The quad graph term.
* @return A new instance of Quad.
* @see Quad
*/
quad(subject: InQuad['subject'], predicate: InQuad['predicate'], object: InQuad['object'], graph?: InQuad['graph']): OutQuad;
}

Spec definition:

Screenshot 2024-09-09 at 16 59 17
@matthieubosquet
Copy link
Contributor Author

See: #46

@tpluscode
Copy link
Contributor

Is it intentional?

I do not think it's intentional.
See, the types themselves were started 7 years ago, without the missing methods: https://github.com/DefinitelyTyped/DefinitelyTyped/blame/e5b56fcf1b8133cc599e9e6d7ff155c4ac7d75be/types/rdf-js/index.d.ts#L204-L266
The new methods were added 2 years later by @elf-pavlik: rdfjs/data-model-spec@52c631d
It would appear that no one noticed until now :)

@elf-pavlik
Copy link
Member

The new methods were added 2 years later by @elf-pavlik: rdfjs/data-model-spec@52c631d

It was requested in rdfjs/data-model-spec#137

tpluscode added a commit that referenced this issue Dec 5, 2024
Issue #45: Add missing spec methods to DataFactory interface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants