Skip to content

Commit

Permalink
Merge branch 'master' of github.com:JanWielemaker/hdt
Browse files Browse the repository at this point in the history
  • Loading branch information
Jan Wielemaker authored and Jan Wielemaker committed Jun 9, 2017
2 parents c2a2746 + 3c1c654 commit 334c18e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
10 changes: 7 additions & 3 deletions c/hdt4pl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,7 @@ PREDICATE(hdt_open, 3)
int indexed = TRUE;
PlTail options(A3);
PlTerm opt;
char *name;

while(options.next(opt))
{ atom_t name;
Expand All @@ -234,15 +235,18 @@ PREDICATE(hdt_open, 3)
return PL_type_error("option", opt);
}

if ( !PL_get_file_name(A2, &name, PL_FILE_EXIST) )
return FALSE;

try
{ if ( access == ATOM_map )
{ if ( indexed )
hdt = HDTManager::mapIndexedHDT(A2);
hdt = HDTManager::mapIndexedHDT(name);
else
hdt = HDTManager::mapHDT(A2);
} else if ( access == ATOM_load )
{ if ( indexed )
hdt = HDTManager::loadIndexedHDT(A2);
hdt = HDTManager::loadIndexedHDT(name);
else
hdt = HDTManager::loadHDT(A2);
} else
Expand Down Expand Up @@ -752,7 +756,7 @@ PREDICATE(hdt_search_cost_id, 5)
try
{ TripleID t(s,p,o);
IteratorTripleID *it = symb->hdt->getTriples()->search(t);
int numResults = it->estimatedNumResults();
long numResults = it->estimatedNumResults();
delete it;
return (A5 = numResults);
} CATCH_HDT;
Expand Down
5 changes: 3 additions & 2 deletions prolog/hdt.pl
Original file line number Diff line number Diff line change
Expand Up @@ -350,13 +350,14 @@
%
% True if a triple with the indicated identifiers exists.

%% hdt_search_cost(HDT, ?S, ?P, ?O, -Cost:float) is det.
%% hdt_search_cost(HDT, ?S, ?P, ?O, -Cost:nonneg) is det.

hdt_search_cost(HDT, S, P, O, Cost) :-
Triple = t(S,P,O),
TripleID = t(SID,PID,OID),
hdt_pre_triple(HDT, Triple, TripleID),
hdt_search_cost_id(HDT, SID, PID, OID, Cost).
hdt_search_cost_id(HDT, SID, PID, OID, Cost), !.
hdt_search_cost(_, _, _, _, 0).


/*******************************
Expand Down

0 comments on commit 334c18e

Please sign in to comment.