Habush / atomspace-rpc

A gRPC server and client to execute pattern matching queries
GNU Affero General Public License v3.0
2 stars 1 forks source link

get_handleset_by_type() missing. #6

Open gl-yziquel opened 9 months ago

gl-yziquel commented 9 months ago

Hi.

I tried compiling atomspace-rpc. It complains about a method get_handleset_by_type not being available. Though it does claim or seem to claim that get_handles_by_type does exist.

It could be possible that such a change occured in dependencies. Anyhow, as of today, this code doesn't compile.

mini-me@virtucon ~/h/c/atomspace-rpc (master)> mkdir build
mini-me@virtucon ~/h/c/atomspace-rpc (master)> cd build/
mini-me@virtucon ~/h/c/a/build (master)> cmake ..
-- The CXX compiler identification is GNU 11.4.0
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found suitable version "1.74.0", minimum required is "1.46") found components: system filesystem program_options 
-- CogUtil version 2.0.3 found.
-- AtomSpace found.
-- Guile (3.0.7 >= 2.2.2) was found.
-- Looking for C++ include pthread.h
-- Looking for C++ include pthread.h - found
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE  
CMake Warning (dev) at /usr/share/cmake-3.22/Modules/FindPackageHandleStandardArgs.cmake:438 (message):
  The package name passed to `find_package_handle_standard_args` (Protobuf)
  does not match the name of the calling package (ProtoBuf).  This can lead
  to problems in calling code that expects `find_package` result variables
  (e.g., `_FOUND`) to follow a certain pattern.
Call Stack (most recent call first):
  /usr/local/lib/cmake/protobuf/protobuf-module.cmake:162 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
  /usr/local/lib/cmake/protobuf/protobuf-config.cmake:21 (include)
  src/CMakeLists.txt:10 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Found Protobuf: /usr/local/bin/protoc-24.2.0 (found version "24.2.0") 
-- Using protobuf 24.2.0
-- Using gRPC 1.59.0-dev
-- AGI-Bio found.
-- Found PythonInterp: /usr/bin/python (found version "3.10.12") 
-- CxxTest found.
-- Configuring done
-- Generating done
-- Build files have been written to: /home/mini-me/home/cellar/atomspace-rpc/build
mini-me@virtucon ~/h/c/a/build (master)> make
[  6%] Running cpp protocol buffer compiler on /home/mini-me/home/cellar/atomspace-rpc/specs/atom_server.proto
[ 12%] Generating atom_server.grpc.pb.cc, atom_server.grpc.pb.h
[ 18%] Building CXX object src/CMakeFiles/atom_server.dir/AtomspaceService.cpp.o
[ 25%] Building CXX object src/CMakeFiles/atom_server.dir/manager/AtomSpaceManager.cpp.o
/home/mini-me/home/cellar/atomspace-rpc/src/manager/AtomSpaceManager.cpp: In member function ‘void AtomSpaceManager::findSimilarNames(const string&, const string&, const string&, opencog::HandleSeq&)’:
/home/mini-me/home/cellar/atomspace-rpc/src/manager/AtomSpaceManager.cpp:142:9: error: ‘using element_type = class opencog::AtomSpace’ {aka ‘class opencog::AtomSpace’} has no member named ‘get_handleset_by_type’; did you mean ‘get_handles_by_type’?
  142 |     as->get_handleset_by_type(atoms, type);
      |         ^~~~~~~~~~~~~~~~~~~~~
      |         get_handles_by_type
make[2]: *** [src/CMakeFiles/atom_server.dir/build.make:104: src/CMakeFiles/atom_server.dir/manager/AtomSpaceManager.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:179: src/CMakeFiles/atom_server.dir/all] Error 2
make: *** [Makefile:136: all] Error 2
mini-me@virtucon ~/h/c/a/build (master) [2]> 
linas commented 9 months ago

try making the suggested change, of using get_handles_by_type

Note also that the cogserver provides a generic json API that might be more general than the code in this repo. There's a README for it, and several examples/demos.

Habush commented 9 months ago

Hi @gl-yziquel (sorry for the late reply). As @linas suggested, you should use the get_handles_by_type method. I'm currently refactoring the code and adding support for Python API that works with Distributed AtomSpace (DAS). I will include the above change when I finally update the repo.

Also, I agree with @linas that if you should checkout the cogserver as it is well-maintained and supports the latest features of the Atomspace. This code was written to work with the annotation service and has a narrower scope/utility than what you'll find at the official Atomspace.

gl-yziquel commented 9 months ago

Thank you for the feedback. I'll try to check that out.

gl-yziquel commented 9 months ago

I made the suggested fix. The build keeps failing because HandleSet has been split into two distinct entities: HandleSeq and UnorderedHandleSet.