File tree 2 files changed +9
-5
lines changed
2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ const consumerJob = new CronJob(CRON_PATTERN, async () => {
92
92
consumer . listen (
93
93
async ( member ) => {
94
94
try {
95
- convertBlankNodes ( member . quads ) ;
95
+ member . quads = convertBlankNodes ( member . quads ) ;
96
96
await processMember ( member , treeProperties ) ;
97
97
} catch ( e ) {
98
98
console . error (
Original file line number Diff line number Diff line change @@ -39,21 +39,25 @@ export function fromDate(date: Date): RDF.Literal {
39
39
40
40
export function convertBlankNodes ( quads : RDF . Quad [ ] ) {
41
41
const blankNodesMap = new Map < RDF . BlankNode , RDF . NamedNode > ( ) ;
42
- quads . forEach ( ( quad ) => {
42
+ return quads . map ( ( quad ) => {
43
43
if ( quad . subject . termType === "BlankNode" ) {
44
44
if ( ! blankNodesMap . has ( quad . subject ) ) {
45
45
blankNodesMap . set ( quad . subject , BLANK ( uuidv4 ( ) ) ) ;
46
46
}
47
- quad . subject = blankNodesMap . get ( quad . subject ) ! ;
48
47
}
49
48
if ( quad . object . termType === "BlankNode" ) {
50
49
if ( ! blankNodesMap . has ( quad . object ) ) {
51
50
blankNodesMap . set ( quad . object , BLANK ( uuidv4 ( ) ) ) ;
52
51
}
53
- quad . object = blankNodesMap . get ( quad . object ) ! ;
52
+ }
53
+ if ( quad . subject . termType === "BlankNode" || quad . object . termType === "BlankNode" ) {
54
+ const newSubject = blankNodesMap . get ( quad . subject ) || quad . subject ;
55
+ const newObject = blankNodesMap . get ( quad . object ) || quad . object ;
56
+ return DataFactory . quad ( newSubject , quad . predicate , newObject , quad . graph ) ;
57
+ } else {
58
+ return quad ;
54
59
}
55
60
} ) ;
56
- return quads ;
57
61
}
58
62
59
63
export function extractVersionTimestamp ( member : Member , treeProperties : TreeProperties ) : Date | null {
You can’t perform that action at this time.
0 commit comments