From e2173c02a18fa2cb50e0f7611229422bcfbb4bbd Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Fri, 28 Apr 2017 17:57:51 +0200 Subject: [PATCH 1/4] FIXED: hdt_open/3: Support unicode file names. --- c/hdt4pl.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/c/hdt4pl.cpp b/c/hdt4pl.cpp index 09df17d..6c1d65c 100644 --- a/c/hdt4pl.cpp +++ b/c/hdt4pl.cpp @@ -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; @@ -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 From fabaf449337b875be05ccbf82cb84bdd0b25be6d Mon Sep 17 00:00:00 2001 From: Wouter Beek Date: Sun, 7 May 2017 19:06:26 +0200 Subject: [PATCH 2/4] FIXED: hdt_search_cost_id/5 would give negative costs for large result sets (e.g., "? ? ?"). --- c/hdt4pl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/hdt4pl.cpp b/c/hdt4pl.cpp index 6c1d65c..b6dfd4c 100644 --- a/c/hdt4pl.cpp +++ b/c/hdt4pl.cpp @@ -755,7 +755,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; From b5dfa00cb97ed61fce38f8dae7a1d88f2df96dc1 Mon Sep 17 00:00:00 2001 From: Wouter Beek Date: Tue, 23 May 2017 09:43:58 +0200 Subject: [PATCH 3/4] FIXED: Let hdt_search_cost/5 succeed (with cost 0) if terms do not appear in the dictionary. --- prolog/hdt.pl | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/prolog/hdt.pl b/prolog/hdt.pl index 1d1b4b2..d6135b4 100644 --- a/prolog/hdt.pl +++ b/prolog/hdt.pl @@ -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). /******************************* From 3c1c6546f103cbda26b116644ec458902f4094a5 Mon Sep 17 00:00:00 2001 From: Jan Wielemaker Date: Tue, 30 May 2017 08:44:44 +0200 Subject: [PATCH 4/4] FIXED: Allow node ids > signed int. --- c/hdt4pl.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/c/hdt4pl.cpp b/c/hdt4pl.cpp index b6dfd4c..ee5ed7a 100644 --- a/c/hdt4pl.cpp +++ b/c/hdt4pl.cpp @@ -665,10 +665,10 @@ get_search_id(term_t t, unsigned *id, unsigned flag, unsigned *flagp) *flagp |= flag; return TRUE; } else - { int i; + { int64_t i; - if ( PL_get_integer_ex(t, &i) ) - { *id = (unsigned)i; + if ( PL_get_int64(t, &i) ) + { *id = (unsigned int)i; return TRUE; } }