@@ -4,34 +4,30 @@ import type { DataFactory, DatasetCore, Term } from "@rdfjs/types"
44type TermWrapperConstructor < T > = new ( term : Term , dataset : DatasetCore , factory : DataFactory ) => T
55
66export class DatasetWrapper extends DatasetCoreBase {
7- protected * subjectsOf < T > ( termWrapper : TermWrapperConstructor < T > , predicate ?: Term , object ?: Term , graph ?: Term ) : Iterable < T > {
7+ protected subjectsOf < T > ( predicate : Term , termWrapper : TermWrapperConstructor < T > ) : Iterable < T > {
8+ return this . matchSubjectsOf ( termWrapper , predicate )
9+ }
10+
11+ protected * matchSubjectsOf < T > ( termWrapper : TermWrapperConstructor < T > , predicate ?: Term , object ?: Term , graph ?: Term ) : Iterable < T > {
812 for ( const q of this . match ( undefined , predicate , object , graph ) ) {
913 yield new termWrapper ( q . subject , this , this . factory )
1014 }
1115 }
1216
13- protected * objectsOf < T > ( termWrapper : TermWrapperConstructor < T > , subject ?: Term , predicate ?: Term , graph ?: Term ) : Iterable < T > {
14- for ( const q of this . match ( subject , predicate , undefined , graph ) ) {
15- yield new termWrapper ( q . object , this , this . factory )
16- }
17+ protected * objectsOf < T > ( predicate : Term , termWrapper : TermWrapperConstructor < T > ) : Iterable < T > {
18+ return this . matchObjectsOf ( termWrapper , undefined , predicate )
1719 }
1820
19- protected * objectsOfX < T > ( [ s , p , g ] : [ Term ? , Term ? , Term ? ] , termWrapper : TermWrapperConstructor < T > ) : Iterable < T > {
20- for ( const q of this . match ( s , p , undefined , g ) ) {
21+ protected * matchObjectsOf < T > ( termWrapper : TermWrapperConstructor < T > , subject ?: Term , predicate ?: Term , graph ?: Term ) : Iterable < T > {
22+ for ( const q of this . match ( subject , predicate , undefined , graph ) ) {
2123 yield new termWrapper ( q . object , this , this . factory )
2224 }
2325 }
2426
25- protected * subjectsOfX < T > ( [ p , o , g ] : [ Term ?, Term ?, Term ?] , termWrapper : TermWrapperConstructor < T > ) : Iterable < T > {
26- for ( const q of this . match ( undefined , p , o , g ) ) {
27- yield new termWrapper ( q . subject , this , this . factory )
28- }
29- }
30-
31- protected instancesOf < T > ( constructor : TermWrapperConstructor < T > , classTerm : Term ) : Iterable < T > {
27+ protected instancesOf < T > ( classTerm : Term , constructor : TermWrapperConstructor < T > ) : Iterable < T > {
3228 // TODO: Vocab
3329 const rdfType = this . factory . namedNode ( "http://www.w3.org/1999/02/22-rdf-syntax-ns#type" )
3430
35- return this . subjectsOf ( constructor , rdfType , classTerm )
31+ return this . matchSubjectsOf ( constructor , rdfType , classTerm )
3632 }
3733}
0 commit comments