@@ -43,7 +43,7 @@ ExternalHdtDatasource.prototype._executeQuery = function (query, tripleStream, m
43
43
'--' , hdtFile ] , { stdio : [ 'ignore' , 'pipe' , 'ignore' ] } ) ;
44
44
// Parse the result triples
45
45
hdt . stdout . setEncoding ( 'utf8' ) ;
46
- var parser = new N3Parser ( ) , tripleCount = 0 , estimatedTotalCount = 0 ;
46
+ var parser = new N3Parser ( ) , tripleCount = 0 , estimatedTotalCount = 0 , exactCount = true ;
47
47
parser . parse ( hdt . stdout , function ( error , triple ) {
48
48
if ( error )
49
49
tripleStream . emit ( 'error' , new Error ( 'Invalid query result: ' + error . message ) ) ;
@@ -53,7 +53,7 @@ ExternalHdtDatasource.prototype._executeQuery = function (query, tripleStream, m
53
53
// Ensure the estimated total count is as least as large as the number of triples
54
54
if ( tripleCount && estimatedTotalCount < offset + tripleCount )
55
55
estimatedTotalCount = offset + ( tripleCount < query . limit ? tripleCount : 2 * tripleCount ) ;
56
- metadataCallback ( { totalCount : estimatedTotalCount , exactCount : false } ) ;
56
+ metadataCallback ( { totalCount : estimatedTotalCount , exactCount : exactCount } ) ;
57
57
tripleStream . push ( null ) ;
58
58
}
59
59
} ) ;
@@ -62,6 +62,7 @@ ExternalHdtDatasource.prototype._executeQuery = function (query, tripleStream, m
62
62
// Extract the estimated number of total matches from the first (comment) line
63
63
hdt . stdout . once ( 'data' , function ( header ) {
64
64
estimatedTotalCount = parseInt ( header . match ( / \d + / ) , 10 ) || 0 ;
65
+ exactCount = header . indexOf ( "Exact" ) > - 1 ;
65
66
} ) ;
66
67
67
68
// Report query errors
0 commit comments