habush / atomspace-rpc Goto Github PK
View Code? Open in Web Editor NEWA gRPC server and client to execute pattern matching queries
License: GNU Affero General Public License v3.0
A gRPC server and client to execute pattern matching queries
License: GNU Affero General Public License v3.0
I may sound like a broken record, but .... I think there are a few small things you can do o improve performance, via caching...
So, here:
change to (const std::string &id, const std::string &pattern, const std::string &key)
and here:
atomspace-rpc/src/manager/AtomSpaceManager.cpp
Lines 86 to 93 in c49b994
change to
// Is there a cached value? If so return it.
ValuePtr pattResult = h->getValue(hkey);
if (nullptr != pattResult) return HandleCast(pattResult);
// Oh no! we have to actually do the work of searching!
pattResult = h->execute(atomspace.get());
h->setValue(hkey, pattResult);
return HandleCast(pattResult);
The search is done only once; after that, the previous cached value is returned "instantlly".
I'm recommending this API because its "compatible" with the previously-mentioned cog-execute-cached!
API. (which BTW is not etched in stone, yet, its still an experimental API)
I'm trying to build this package, (so that I can build the latest annotation-scheme
, and its now failing with
CMake Error at src/CMakeLists.txt:10 (find_package):
Could not find a package configuration file provided by "protobuf" with any
of the following names:
protobufConfig.cmake
protobuf-config.cmake
... ???
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]>
for atomspace commit 16790c7005a80eb70a1281cfac85a00512140bb8 (october 7, 2021)
and Habush/atomspace-rpc current master
and current atomspace from mozi.ai
running the annotation service docker locally produces this error:
...
Server listening on 0.0.0.0:50051
Error: Unbalanced parenthesis >>; [5a6822854d80fb0c][1]
(ListLink
(GeneNode "BRCA2") ; [1bd83328eeb5d294][1]
(VariableNode "$name") ; [75727d82789ac7d3][1]
) ; [84dd65680014bcb3][1]
) ; [d7f6fd7b9a2c82a1][1]
) ; [b4e851f7c5197785][1]<<
accessing from the guile REPL works for find-similar-node but not for exec-pattern:
scheme@(guile-user)> (find-similar-node "prod-atom" "Gene" "BRC")
$27 = ((GeneNode "BRCA3")
(GeneNode "BRCA2")
(GeneNode "BRCC3")
(GeneNode "BRCA1")
(GeneNode "BRCA2(IV)")
)
scheme@(guile-user)> (exec-pattern "prod-atom" (Meet (Member (Gene "IGF1") (Variable "$pway"))))
ice-9/boot-9.scm:1669:16: In procedure raise-exception:
Throw to key `C++-EXCEPTION' with args `("exec-pattern" "Executing pattern failed. Reason: Unbalanced parenthesis >>; [37b917f182563377][1]\n (VariableNode \"$pway\") ; [6f5de7f213daa0f5][1]\n ) ; [856d2984e6de3e64][1]\n) ; [834184a90d6d83b9][1]<<\nFunction args:\n(prod-atom (MeetLink\n (MemberLink\n (GeneNode \"IGF1\")\n (VariableNode \"$pway\")))\n)")'.
corresponding error output from atomspace-rpc binary is:
Error: Unbalanced parenthesis >>; [37b917f182563377][1]
(VariableNode "$pway") ; [6f5de7f213daa0f5][1]
) ; [856d2984e6de3e64][1]
) ; [834184a90d6d83b9][1]<<
does it matter which atomspace? does it matter which version of boost? is it necessary to clone the repos for grpc and jason requirements?
to be user friendly, getting the system installed shouldn't require more than cut and paste.
after installing gRPC from repo i get this error:
CMake Error at src/CMakeLists.txt:18 (protobuf_generate_cpp):
Unknown CMake command "protobuf_generate_cpp".
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.