feat: Support strings in addQuad.

This commit is contained in:
Ruben Verborgh
2021-01-02 18:13:28 +01:00
parent a572825909
commit feaac1cf56
5 changed files with 93 additions and 30 deletions

View File

@@ -78,8 +78,8 @@ export class RepresentationMetadata {
if (!Array.isArray(objects)) {
objects = [ objects ];
}
for (const object of objects.map(toObjectTerm)) {
this.store.addQuad(this.id, namedPredicate, object);
for (const object of objects) {
this.store.addQuad(this.id, namedPredicate, toObjectTerm(object, true));
}
}
}
@@ -149,7 +149,7 @@ export class RepresentationMetadata {
* @param object - Value to add.
*/
public add(predicate: NamedNode | string, object: NamedNode | Literal | string): this {
this.store.addQuad(this.id, toCachedNamedNode(predicate), toObjectTerm(object));
this.store.addQuad(this.id, toCachedNamedNode(predicate), toObjectTerm(object, true));
return this;
}
@@ -159,7 +159,7 @@ export class RepresentationMetadata {
* @param object - Value to remove.
*/
public remove(predicate: NamedNode | string, object: NamedNode | Literal | string): this {
this.store.removeQuad(this.id, toCachedNamedNode(predicate), toObjectTerm(object));
this.store.removeQuad(this.id, toCachedNamedNode(predicate), toObjectTerm(object, true));
return this;
}