### Start GHCi with AtomSpace Source: https://github.com/opencog/atomspace/blob/master/examples/haskell/README.md Launches the GHCi interactive environment with the necessary Haskell AtomSpace flags enabled. Requires the environment to be set up via STACK_YAML. ```bash export STACK_YAML=/opencog/haskell/stack.yaml stack ghci --ghc-options -lhaskell-atomspace ``` -------------------------------- ### Compile Haskell AtomSpace Examples Source: https://github.com/opencog/atomspace/blob/master/examples/haskell/README.md Compiles a Haskell example file using the stack GHC compiler. This command assumes the environment has been correctly set up with STACK_YAML. ```bash stack ghc example.hs ``` -------------------------------- ### Install OCaml Development Tools Source: https://github.com/opencog/atomspace/blob/master/examples/ocaml/README.md Installs necessary OCaml development tools on Debian/Ubuntu/Mint systems using apt. This is a prerequisite for compiling and using the AtomSpace OCaml bindings. ```shell apt install ocaml ocaml-findlib ``` -------------------------------- ### Set Haskell Environment Stack Source: https://github.com/opencog/atomspace/blob/master/examples/haskell/README.md Configures the stack environment for building and running Haskell AtomSpace examples by setting the STACK_YAML variable to the project's stack configuration file. ```bash export STACK_YAML=/opencog/haskell/stack.yaml ``` -------------------------------- ### Installation Rules Source: https://github.com/opencog/atomspace/blob/master/examples/c++-guile/CMakeLists.txt Specifies how the built 'example' library and its associated SCM file should be installed. It defines destination directories based on CMake variables like LIB_DIR_SUFFIX and GUILE_SITE_DIR. ```cmake # INSTALL (TARGETS example DESTINATION "lib${LIB_DIR_SUFFIX}/opencog") # INSTALL (FILES opencog/example.scm DESTINATION "${GUILE_SITE_DIR}/opencog") ``` -------------------------------- ### Python: AtomSpace Storage Tutorial Source: https://github.com/opencog/atomspace/blob/master/examples/python/README.md A comprehensive example demonstrating basic AtomSpace concepts, practical usage, and the API for storing data to disk. This tutorial is suitable for beginners to get started with persistent AtomSpace data. ```python # Example from storage_tutorial.py # (Actual code not provided in source text, but described) # This script covers concepts like AtomSpace initialization, # creating various Atom types, and using StorageNodes for persistence. ``` -------------------------------- ### Start OCaml Interpreter with AtomSpace Source: https://github.com/opencog/atomspace/blob/master/examples/ocaml/README.md Demonstrates how to start the OCaml interpreter and load the AtomSpace library. It shows two methods: using '#directory' and '#use' directives, or passing the directory via the '-I' option. ```shell $ rlwrap ocaml #directory "/usr/local/lib/opencog/ocaml/" ;; #use "atomese.ml" ;; ``` ```shell $ rlwrap ocaml -I "/usr/local/lib/opencog/ocaml/" #use "atomese.ml" ;; ``` -------------------------------- ### Troubleshoot Shared Library Loading Errors Source: https://github.com/opencog/atomspace/blob/master/examples/haskell/README.md Provides steps to resolve 'cannot open shared object file' errors when running AtomSpace Haskell examples. This involves updating the system's dynamic loader configuration. ```bash # Add the AtomSpace library directory to ld.so.conf sudo bash -c 'echo "/usr/local/lib/opencog" >> /etc/ld.so.conf' # Verify the shared object file exists # ls /usr/local/lib/opencog/libhaskell-atomspace.so # Update the loader's cache sudo ldconfig /usr/local/lib/opencog/ ``` -------------------------------- ### Custom Target for Demo Installation Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/demo-types/CMakeLists.txt Defines a custom CMake target 'install-demotypes' that allows users to install the demo system components with a specific make command. This target depends on the 'examples' target and executes the 'make install' command. ```cmake ADD_CUSTOM_TARGET (install-demotypes DEPENDS examples WORKING_DIRECTORY . COMMAND $(MAKE) install COMMENT "Installing examples ..." ) ``` -------------------------------- ### Install Python Nose Framework Source: https://github.com/opencog/atomspace/blob/master/tests/cython/README.md Installs the 'nose' Python testing framework using the apt-get package manager. This is a prerequisite for running the project's tests. ```bash apt-get install python3-nose ``` -------------------------------- ### Build OpenCog Atomspace C++ Examples Source: https://github.com/opencog/atomspace/blob/master/examples/c++/README.md Instructions to build all C++ examples using the `make` utility. This command assumes a properly configured build environment and that you are in the `build` directory. The resulting binaries are placed in `build/examples/c++`. ```Shell make examples ``` -------------------------------- ### CMake Build Configuration for opencog/atomspace Source: https://github.com/opencog/atomspace/blob/master/examples/c++/CMakeLists.txt This CMakeLists.txt file sets up the build environment for the opencog/atomspace project. It defines an executable named 'basic' compiled from 'basic.cc' and links it to the 'atomspace' library. The file also contains commented-out examples for installing targets and files. ```CMake INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) ADD_EXECUTABLE(basic basic.cc ) TARGET_LINK_LIBRARIES(basic atomspace ) # This is what the install should look like. # INSTALL (TARGETS example DESTINATION "lib${LIB_DIR_SUFFIX}/opencog") # INSTALL (FILES opencog/example.scm DESTINATION "${GUILE_SITE_DIR}/opencog") ``` -------------------------------- ### CMake: Configure Example Build Target Source: https://github.com/opencog/atomspace/blob/master/CMakeLists.txt Defines a custom target named `examples` to build all example projects. It uses `$(MAKE)` to ensure proper parallel job execution and specifies the working directory as `examples`. This target allows users to easily build all provided examples. ```cmake ADD_SUBDIRECTORY(examples EXCLUDE_FROM_ALL) ADD_CUSTOM_TARGET (examples COMMAND $(MAKE) WORKING_DIRECTORY examples COMMENT "Building examples" ) ``` -------------------------------- ### Compile Basic C++ Example Source: https://github.com/opencog/atomspace/blob/master/examples/c++/README.md Command to compile a basic C++ example file (`basic.cc`) and link it with necessary OpenCog libraries. This process requires a C++ compiler (like g++) and the OpenCog libraries to be installed and accessible via the include and library paths. It first compiles the source to an object file and then links it into an executable. ```Shell g++ -std=c++17 -c basic.cc g++ -o basic basic.o -L/usr/local/lib/opencog -latom_types -latombase -latomspace ``` -------------------------------- ### Python: Exploring OpenCog Modules Source: https://github.com/opencog/atomspace/blob/master/examples/python/README.md Demonstrates how to inspect the installed OpenCog Python modules and their contents using the built-in Python help() and dir() functions. This is useful for understanding the available API and data structures. ```python help('opencog') import opencog.atomspace import opencog.type_constructors print(dir(opencog.atomspace)) print(dir(opencog.type_constructors)) ``` -------------------------------- ### Run Basic C++ Example Source: https://github.com/opencog/atomspace/blob/master/examples/c++/README.md Command to execute the compiled basic C++ example. This assumes the executable binary (`basic`) has been successfully created in the current directory and that all its dependencies are met. ```Shell $ ./basic ``` -------------------------------- ### Start Guile REPL Source: https://github.com/opencog/atomspace/blob/master/examples/atomspace/README.md Command to launch the Guile interpreter from the terminal. This starts the read-evaluate-print loop (REPL) where Scheme code can be executed. ```shell $ guile ``` -------------------------------- ### C++ Usage Example Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/README.md This snippet shows how to run a C++ example (`chemain.cc`) that demonstrates the usage of custom Atom Types. The example is built as part of the `make examples` process, and can be executed from the build directory using the provided path. ```Shell ./examples/type-system/apps/cpp-types-demo ``` -------------------------------- ### Optional Compile Options Source: https://github.com/opencog/atomspace/blob/master/opencog/query/CMakeLists.txt Examples of optional compile-time definitions that can be enabled for the query-engine library, such as debug logging or multi-threaded pattern matching. ```cmake # Optionally enable debug logging for the pattern matcher. # TARGET_COMPILE_OPTIONS(query-engine PRIVATE -DQDEBUG=1) # Optionally enable multi-threaded pattern matcher. Experimental. # TARGET_COMPILE_OPTIONS(query-engine PRIVATE -DUSE_THREADED_PATTERN_ENGINE=1) ``` -------------------------------- ### Install Atomspace via make install Source: https://github.com/opencog/atomspace/blob/master/README.md This command installs the AtomSpace after it has been successfully built. It is a system-level installation step required before using the AtomSpace in applications. ```shell sudo make install ``` -------------------------------- ### Install Query Engine Library and Headers Source: https://github.com/opencog/atomspace/blob/master/opencog/query/CMakeLists.txt Configures the installation of the query-engine library targets and header files to their designated locations within the OpenCog installation directory. ```cmake INSTALL (TARGETS query-engine EXPORT AtomSpaceTargets DESTINATION "lib${LIB_DIR_SUFFIX}/opencog") INSTALL (FILES ContinuationMixin.h Implicator.h InitiateSearchMixin.h PatternMatchCallback.h PatternMatchEngine.h RewriteMixin.h Satisfier.h SatisfyMixin.h TermMatchMixin.h DESTINATION "include/opencog/query" ) ``` -------------------------------- ### Prerequisites Installation Commands Source: https://github.com/opencog/atomspace/blob/master/README.md Commands for installing essential and optional prerequisites for building the OpenCog AtomSpace on Debian/Ubuntu and Fedora/Redhat systems. ```shell # Essential Prerequisites (Debian/Ubuntu) apt install cmake apt install guile-3.0-dev apt install cxxtest # Essential Prerequisites (Fedora/Redhat) yum install cmake yum install guile30-devel yum install cxxtest # Optional Prerequisites (Debian/Ubuntu) apt install cython libpython3-dev # Optional Prerequisites (Fedora/Redhat) yum install cython python3-devel # Optional OCaml (Debian/Ubuntu) ocaml ocaml-findlib ``` -------------------------------- ### CMake INSTALL Command for OpenCog Atomspace Files Source: https://github.com/opencog/atomspace/blob/master/cmake/CMakeLists.txt This snippet demonstrates the CMake INSTALL command used to copy specified files to a destination directory. It lists the files to be installed and the target directory, typically used during the build and installation process of the OpenCog Atomspace project. ```cmake INSTALL(FILES OpenCogAtomTypes.cmake OpenCogCython.cmake OpenCogGenCxxTypes.cmake OpenCogGenOCamlTypes.cmake OpenCogGenPythonTypes.cmake OpenCogGenScmTypes.cmake OpenCogGenTypes.cmake OpenCogGenWrapper.cmake OpenCogGuile.cmake OpenCogOCaml.cmake OpenCogMacros.cmake OpenCogFunctions.cmake DESTINATION ${DATADIR}/cmake/) ``` -------------------------------- ### Install C++ Shared Library and Headers Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/demo-types/CMakeLists.txt Manages the installation of the compiled C++ shared library and header files into specific directories within the system's file structure. This includes installing the main library, type definitions, and atom names headers. ```cmake INSTALL (TARGETS chem-demo-types LIBRARY DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/chem_types.h DESTINATION "include/opencog/demo-types" ) INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/atom_names.h DESTINATION "include/opencog/demo-types" ) ``` -------------------------------- ### Install Dependencies via easy_install Source: https://github.com/opencog/atomspace/blob/master/opencog/cython/README.md Installs Cython and the Nose testing framework using the easy_install tool. ```shell sudo easy_install cython nose3 ``` -------------------------------- ### Install GenericEval.h Source: https://github.com/opencog/atomspace/blob/master/opencog/eval/CMakeLists.txt This directive specifies the installation of the GenericEval.h file. It is intended to be placed in the include/opencog/eval directory during the build or installation process. ```buildscript INSTALL (FILES GenericEval.h DESTINATION "include/opencog/eval" ) ``` -------------------------------- ### Install Clearbox Library and Headers Source: https://github.com/opencog/atomspace/blob/master/opencog/atoms/reduct/CMakeLists.txt Specifies the installation targets for the 'clearbox' library and its header files. The library is installed into the 'lib/opencog' directory, and headers are placed in 'include/opencog/atoms/reduct'. ```cmake INSTALL (TARGETS clearbox EXPORT AtomSpaceTargets DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) INSTALL (FILES AccumulateLink.h ArithmeticLink.h BoolOpLink.h DecimateLink.h DivideLink.h ElementOfLink.h FoldLink.h ImpulseLink.h MaxLink.h MinLink.h MinusLink.h NumericFunctionLink.h PlusLink.h TimesLink.h DESTINATION "include/opencog/atoms/reduct" ) ``` -------------------------------- ### Install Guile Scheme Files Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/demo-types/CMakeLists.txt Installs Guile Scheme configuration and demo files into the appropriate Guile site directories. This ensures that the demo system's Scheme components are accessible by the Guile interpreter. ```cmake INSTALL (FILES ${CMAKE_CURRENT_BINARY_DIR}/chem_types.scm DESTINATION "${GUILE_SITE_DIR}/opencog/demo-types/" ) INSTALL( FILES ${GUILE_BIN_DIR}/opencog/chemodemo-config-installable.scm DESTINATION ${GUILE_SITE_DIR}/opencog RENAME chemodemo-config.scm ) ``` -------------------------------- ### Install OCaml Prerequisites Source: https://github.com/opencog/atomspace/blob/master/opencog/ocaml/README.md Installs necessary OCaml development tools using the apt package manager. These are required for compiling and running OCaml code. ```bash apt install ocaml ocaml-findlib ``` -------------------------------- ### Install AtomSpace Targets Source: https://github.com/opencog/atomspace/blob/master/opencog/guile/modules/CMakeLists.txt Installs the compiled libraries (exec, logger, randgen, type-utils) for the AtomSpace project, exporting AtomSpaceTargets and placing them in the appropriate library directory. ```build-system INSTALL (TARGETS exec logger randgen type-utils EXPORT AtomSpaceTargets DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) ``` -------------------------------- ### Install Dependencies via apt-get Source: https://github.com/opencog/atomspace/blob/master/opencog/cython/README.md Installs Cython and the Python 3 Nose testing framework using the apt-get package manager. ```shell sudo apt-get install cython python3-nose ``` -------------------------------- ### Scheme Usage Example Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/README.md This snippet shows how to run a Scheme example file (`hello-chem.scm`) that utilizes the custom Atom Types. The command `guile -s hello-chem.scm` executes the script using the Guile interpreter, demonstrating the Scheme bindings. ```Shell guile -s hello-chem.scm ``` -------------------------------- ### Python AST Storage Example Source: https://github.com/opencog/atomspace/blob/master/examples/foreign/README.md Demonstrates storing Python code as an Abstract Syntax Tree (AST) in the AtomSpace. The example shows a Python expression and highlights that variables like 'a' and 'b' do not need definition when stored, not executed. This enables complex queries on the stored code structure. ```python x = list(("apple", set(( 1, 2, 3)), "cherry")) print("the result:", a+b) ``` -------------------------------- ### Install ACM LaTeX Class and Layout Files Source: https://github.com/opencog/atomspace/blob/master/opencog/sheaf/docs/tods-2024/README.md Provides instructions for installing the ACM LaTeX class file (`acmart.cls`) and layout file (`acmart.layout`) for use with LyX and TeX Live. Includes commands for updating the TeX file database and configuring LyX. ```text Copy `acmart.cls` to `/usr/share/texmf/tex/latex/` Run `sudo texhash` Copy `acmart.layout` to `~/.lyx/layouts/` Run reconfigure and restart LyX Select acmart in Document->Settings->Document Class Custom config `acmsmall` ``` -------------------------------- ### Compile Haskell Example Source: https://github.com/opencog/atomspace/blob/master/opencog/haskell/README.md Instructions for compiling a Haskell example file using Stack. This involves setting the STACK_YAML environment variable to point to the project's configuration file. ```Bash export STACK_YAML=/opencog/haskell/stack.yaml stack ghc example.hs ``` -------------------------------- ### Scheme Deduction Engine Example Source: https://github.com/opencog/atomspace/blob/master/examples/pattern-matcher/README.md Features an example of a Prolog-like reasoning engine implemented in Scheme. This script explores complex deduction capabilities within the AtomSpace framework. ```scheme ; deduction-engine.scm: a ProLog-like reasoning engine ``` -------------------------------- ### Install AtomSpace C Wrapper Library Source: https://github.com/opencog/atomspace/blob/master/opencog/haskell/CMakeLists.txt Defines the installation rules for the atomspace-cwrapper target, specifying its destination directory within the library path. ```cmake INSTALL (TARGETS atomspace-cwrapper DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) ``` -------------------------------- ### Install OCaml AtomSpace Library Source: https://github.com/opencog/atomspace/blob/master/opencog/ocaml/README.md Installs the AtomSpace OCaml library using ocamlfind. This command registers the modules and shared libraries for use in OCaml projects. ```bash sudo ocamlfind install atomspace dllcamlatoms.so atomspace.cma \ atomspace.cmi atoms.cmi storage.cmi META ``` -------------------------------- ### Python: Nameserver and Class Factory Example Source: https://github.com/opencog/atomspace/blob/master/examples/python/README.md Demonstrates the advanced use of the AtomSpace nameserver and class factory, which allows direct access to Atom Types. This feature is typically needed for very specific or low-level development tasks. ```python # Example from nameserver_example.py # (Actual code not provided in source text, but described) # This script shows how to use the nameserver to dynamically # instantiate Atom types, a feature for advanced users. ``` -------------------------------- ### Python: Behavior Tree with Grounded Predicates Source: https://github.com/opencog/atomspace/blob/master/examples/python/README.md An example showcasing a 'behavior tree' implementation, highlighting the use of GroundedPredicateNode to call Python functions from within Atomese. This enables hybrid AI systems combining symbolic reasoning and procedural code. ```python # Example from stop_go.py # (Actual code not provided in source text, but described) # This script demonstrates integrating Python logic into Atomese # via GroundedPredicateNodes, forming a behavior tree. ``` -------------------------------- ### Python Usage Example Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/README.md This snippet demonstrates how to run a Python example file (`chemy-hello.py`) that uses the custom Atom Types. The command `python3 chemy-hello.py` executes the script, showcasing the Python (Cython) bindings for the custom types. ```Shell python3 chemy-hello.py ``` -------------------------------- ### CMake Build Configuration Source: https://github.com/opencog/atomspace/blob/master/README.md Example of using CMake to configure the build process for the OpenCog AtomSpace project. ```cmake cmake .. # CMake will output which optional parts will not be built if prerequisites are missing. ``` -------------------------------- ### Python: Running AtomSpace Tutorials Source: https://github.com/opencog/atomspace/blob/master/examples/python/README.md Provides instructions on how to execute the provided Python tutorial scripts from the command line. These scripts cover various aspects of AtomSpace usage, from basic atom creation to advanced vectorization. ```bash python3 storage_tutorial.py ``` -------------------------------- ### Setup and Build Haskell Bindings Source: https://github.com/opencog/atomspace/blob/master/opencog/haskell/README.md Commands to navigate to the Haskell bindings directory, set up the environment using Stack, and build the project. This is the initial step for using the Haskell bindings. ```Bash cd /opencog/haskell stack setup ``` -------------------------------- ### Configure OCaml Init for AtomSpace Source: https://github.com/opencog/atomspace/blob/master/examples/ocaml/README.md Shows how to configure the OCaml initialization file (~/.ocamlinit) to automatically load the AtomSpace library upon interpreter startup. This makes Atomese commands readily available. ```ocaml #directory "/usr/local/lib/opencog/ocaml/" ;; #use "atomese.ml" ;; ``` -------------------------------- ### OpenCog Guile Module Loading Examples Source: https://github.com/opencog/atomspace/blob/master/examples/atomspace/README.md Lists various OpenCog modules that can be loaded using the `(use-modules ...)` expression in Guile. It categorizes modules by their status (core, other projects, experimental). ```scheme ; Core AtomSpace modules (use-modules (opencog)) (use-modules (opencog atom-types)) (use-modules (opencog csv-table)) (use-modules (opencog exec)) (use-modules (opencog logger)) (use-modules (opencog matrix)) (use-modules (opencog persist)) (use-modules (opencog persist-cog)) (use-modules (opencog persist-file)) (use-modules (opencog persist-rocks)) (use-modules (opencog persist-sql)) (use-modules (opencog python)) (use-modules (opencog randgen)) (use-modules (opencog sheaf)) (use-modules (opencog test-runner)) (use-modules (opencog type-utils)) (use-modules (opencog uuid)) ``` ```scheme ; Modules from other projects/repos (use-modules (opencog cogserver)) (use-modules (opencog learn)) (use-modules (opencog nlp)) (use-modules (opencog nlp lg-dict)) (use-modules (opencog nlp lg-export)) ``` ```scheme ; Obsolete/Unmaintained modules (use-modules (opencog attention)) (use-modules (opencog attention-bank)) (use-modules (opencog ghost)) (use-modules (opencog miner)) (use-modules (opencog nlp aiml)) (use-modules (opencog nlp chatbot)) (use-modules (opencog nlp chatbot-eva)) ``` -------------------------------- ### Configure Python Path for AtomSpace Tests Source: https://github.com/opencog/atomspace/blob/master/tests/cython/README.md Sets the PYTHONPATH environment variable to include necessary directories for the OpenCog AtomSpace project. This ensures Python can find the required modules during testing. Multiple configurations are provided depending on the installation or source directory. ```bash export PYTHONPATH=${PROJECT_BINARY_DIR}/opencog/cython ``` ```bash export PYTHONPATH=/usr/local/lib/python3.9/dist-packages/opencog:${PYTHON} ``` ```bash export PYTHONPATH=tests/cython/bindlink PROJECT_SOURCE_DIR=. ``` -------------------------------- ### Executable and Library Targets Source: https://github.com/opencog/atomspace/blob/master/examples/c++-guile/CMakeLists.txt Defines the main executable 'PrimitiveExample' and a library 'example'. It specifies the source files for each target and links them against required libraries like 'smob', 'atomspace', and 'clearbox'. ```cmake ADD_EXECUTABLE(PrimitiveExample PrimitiveExample.cc ) TARGET_LINK_LIBRARIES(PrimitiveExample smob atomspace clearbox ) ADD_LIBRARY (example ExampleSCM.cc ) TARGET_LINK_LIBRARIES(example smob atomspace ) ``` -------------------------------- ### Install Foreign Library and Headers (CMake) Source: https://github.com/opencog/atomspace/blob/master/opencog/atoms/foreign/CMakeLists.txt Configures the installation process for the 'foreign' library target and its associated header files. The library is installed into a specific subdirectory within the installation prefix, and headers are placed in the 'include/opencog/atoms/foreign' directory. ```cmake INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_BINARY_DIR}) INSTALL (TARGETS foreign EXPORT AtomSpaceTargets DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) INSTALL (FILES DatalogAST.h ForeignAST.h SexprAST.h DESTINATION "include/opencog/atoms/foreign" ) ``` -------------------------------- ### CMake: Install Column Vector Components Source: https://github.com/opencog/atomspace/blob/master/opencog/atoms/columnvec/CMakeLists.txt Configures the installation of the 'columnvec' library and its header files. The library is installed into the opencog lib directory, and headers are placed in the include/opencog/atoms/columnvec directory. ```cmake INSTALL (TARGETS columnvec EXPORT AtomSpaceTargets DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) INSTALL (FILES FloatColumn.h LinkColumn.h SexprColumn.h TransposeColumn.h DESTINATION "include/opencog/atoms/columnvec" ) ``` -------------------------------- ### Export and Install AtomSpace Targets Source: https://github.com/opencog/atomspace/blob/master/lib/CMakeLists.txt Configures CMake to export targets for the AtomSpace library and installs them to the specified destination. This allows other projects to find and link against AtomSpace. ```cmake string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type ) export(EXPORT AtomSpaceTargets FILE "${CMAKE_CURRENT_BINARY_DIR}/AtomSpace/AtomSpaceTargets.cmake" ) set(ConfigPackageLocation lib/cmake/AtomSpace) install(EXPORT AtomSpaceTargets FILE AtomSpaceTargets.cmake DESTINATION ${ConfigPackageLocation} ) ``` -------------------------------- ### Install OCaml Targets and Interfaces Source: https://github.com/opencog/atomspace/blob/master/opencog/ocaml/CMakeLists.txt Installs the compiled OCaml libraries and their corresponding interface files to the specified OpenCog OCaml directory. Also installs the 'camlatoms' target and 'atomese.ml'. ```cmake INSTALL_OCAML_TARGETS( atomspace DESTINATION "lib${LIB_DIR_SUFFIX}/opencog/ocaml") # Attention: the second (and subsequent) argument is the name of # the mli (cmi) file, for example foo.mli, as noted above. INSTALL_OCAML_INTERFACES( atomspace atomspace atoms storage DESTINATION "lib${LIB_DIR_SUFFIX}/opencog/ocaml") INSTALL (TARGETS camlatoms DESTINATION "lib${LIB_DIR_SUFFIX}/opencog/ocaml") INSTALL(FILES atomese.ml DESTINATION "lib${LIB_DIR_SUFFIX}/opencog/ocaml") ``` -------------------------------- ### OpenCog AtomSpace CMake Build Setup Source: https://github.com/opencog/atomspace/blob/master/tests/cython/CMakeLists.txt Configures include and link directories, and links essential libraries for the OpenCog Atomspace project. It sets up dependencies for Python and Guile integration. ```CMake INCLUDE_DIRECTORIES( ${Python3_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/opencog/atomspace ${PROJECT_SOURCE_DIR}/opencog/guile ${PROJECT_SOURCE_DIR}/opencog/util ) LINK_DIRECTORIES( ${PROJECT_BINARY_DIR}/opencog/atomspace ${PROJECT_BINARY_DIR}/opencog/guile ${PROJECT_BINARY_DIR}/opencog/util ) IF (HAVE_GUILE) LINK_LIBRARIES(smob) ENDIF (HAVE_GUILE) LINK_LIBRARIES( atomspace ${GUILE_LIBRARIES} ) set(TEST_ENVIRONMENT "PYTHONDONTWRITEBYTECODE=1" "PROJECT_SOURCE_DIR=${PROJECT_SOURCE_DIR}" "PYTHONPATH=${PROJECT_BINARY_DIR}/opencog/cython" "GUILE_LOAD_PATH=${GUILE_LOAD_PATH}") ``` -------------------------------- ### Install Haskell Bindings Globally Source: https://github.com/opencog/atomspace/blob/master/opencog/haskell/README.md Commands to install the Haskell bindings globally using Stack. This involves setting the STACK_YAML environment variable and using stack install with extra library directories. ```Bash export STACK_YAML=/opencog/haskell/stack.yaml stack install opencog-atomspace --extra-lib-dirs=/usr/local/lib/opencog ``` -------------------------------- ### Pattern Matching Example with Unordered Links Source: https://github.com/opencog/atomspace/blob/master/opencog/query/README.md Illustrates a pattern matching scenario involving an unordered SetLink, demonstrating how permutations must be considered. This highlights the complexity arising from unordered structures in graph matching. ```text Search Pattern: AndLink SetLink VariableNode $a VariableNode $b ListLink VariableNode $a ConceptNode "fizz" Universe Graphs: SetLink ConceptNode "dribble" ConceptNode "bubble" ListLink ConceptNode "bubble" ConceptNode "fizz" ``` -------------------------------- ### Install truthvalue Library and Headers (CMake) Source: https://github.com/opencog/atomspace/blob/master/opencog/atoms/truthvalue/CMakeLists.txt Installs the compiled 'truthvalue' library target and its associated header files to their designated locations for use by other projects. ```CMake INSTALL (TARGETS truthvalue EXPORT AtomSpaceTargets DESTINATION "lib${LIB_DIR_SUFFIX}/opencog" ) INSTALL (FILES CountTruthValue.h FormulaTruthValue.h SimpleTruthValue.h TruthValue.h DESTINATION "include/opencog/atoms/truthvalue" ) ``` -------------------------------- ### LyX Article Template Discovery Source: https://github.com/opencog/atomspace/blob/master/opencog/sheaf/docs/tods-2024/README.md A note on discovering the `acmart.lyx` article template, which simplifies the setup process for ACM submissions in LyX. ```text There's an `acmart.lyx` article template that would have resolved all of the above! ``` -------------------------------- ### Create AtomNode in Guile Source: https://github.com/opencog/atomspace/blob/master/examples/atomspace/README.md Example of creating an AtomNode, specifically a ConceptNode, within the Guile REPL after loading the OpenCog module. Demonstrates basic AtomSpace object creation. ```scheme (ConceptNode "asdf") ``` -------------------------------- ### CMakeLists Configuration for cpp-types-demo Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/apps/CMakeLists.txt This snippet defines the build process for the `cpp-types-demo` executable. It includes necessary directories, specifies the source file, and lists the libraries required for linking. ```cmake # # Demo chemistry apps. # # The chem_types.h file is written to the build directory INCLUDE_DIRECTORIES(${CMAKE_BINARY_DIR}) ADD_EXECUTABLE(cpp-types-demo chemain.cc ) TARGET_LINK_LIBRARIES(cpp-types-demo ${OPENCOG_atomspace_LIRARIES} chem-demo-types atomspace ) ``` -------------------------------- ### Guile Load Path Verification and Modification Source: https://github.com/opencog/atomspace/blob/master/examples/atomspace/README.md Demonstrates how to check Guile's module search path and how to add a new directory to it. This is crucial for Guile to find installed modules like OpenCog. ```APIDOC Guile Load Path Management: Check Load Path: > %load-path - Displays the current list of directories Guile searches for modules. - Expected output example: ("/usr/share/guile/3.0" "/usr/share/guile/site/3.0" ...) Add to Load Path (Temporary): (add-to-load-path "/path/to/your/modules") - Adds a specified directory to the load path for the current session. Add to Load Path (Permanent): - Add the `(add-to-load-path "/path/to/your/modules")` expression to your `~/.guile` file to make the change persistent across sessions. ``` -------------------------------- ### Scheme: Multiplication Examples Source: https://github.com/opencog/atomspace/blob/master/opencog/atoms/reduct/README.md Provides examples of multiplication operations with constants and variables using `cog-execute!` in Scheme, including identity and combination of terms. ```Scheme (cog-execute! (TimesLink (NumberNode 1) (VariableNode "$x"))) ``` ```Scheme (cog-execute! (TimesLink (VariableNode "$y") (NumberNode 1) (VariableNode "$x"))) ``` ```Scheme (cog-execute! (TimesLink (VariableNode "$y") (NumberNode 0.5) (VariableNode "$x") (PlusLink (NumberNode 1) (NumberNode 1)))) ``` -------------------------------- ### APIDOC: `get` Function for AtomSpace Source: https://github.com/opencog/atomspace/blob/master/opencog/haskell/README.md The `get` function retrieves an atom from the AtomSpace. It returns the atom along with its potentially updated mutable information. ```APIDOC get :: Atom a -> AtomSpace (Maybe (Atom a)) - Retrieves an atom from the atomspace. - Returns the atom with updated mutable information, or Nothing if not found. ``` -------------------------------- ### Installation of Python Bindings and Headers Source: https://github.com/opencog/atomspace/blob/master/opencog/cython/opencog/CMakeLists.txt Installs Cython header files and compiled Python modules to their respective locations for use by the OpenCog Python API. ```cmake INSTALL (FILES __init__.py atomspace.pxd logger.pxd value_types.pxd DESTINATION "include/opencog/cython/opencog" ) INSTALL(TARGETS atomspace_cython exec_cython logger_cython type_constructors utilities_cython DESTINATION "${PYTHON_DEST}") ``` -------------------------------- ### Build Guile Scheme Module Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/demo-types/CMakeLists.txt Configures and builds a Guile Scheme module for the chemistry demo. This involves defining configuration targets, adding the extension, and writing configuration files to make the module discoverable. ```CMake DECLARE_GUILE_CONFIG_TARGET(CHEMODEMO_CONFIG "opencog chemodemo-config" "FOO_TEST") ADD_GUILE_EXTENSION(CHEMODEMO_CONFIG chem-demo-types "opencog-ext-path-chemodemo") WRITE_GUILE_CONFIG( ${GUILE_BIN_DIR}/opencog/chemodemo-config.scm CHEMODEMO_CONFIG TRUE ) WRITE_GUILE_CONFIG( ${GUILE_BIN_DIR}/opencog/chemodemo-config-installable.scm CHEMODEMO_CONFIG FALSE ) ADD_GUILE_MODULE (FILES demo-types.scm MODULE_DESTINATION "${GUILE_SITE_DIR}/opencog/demo-types" ) ``` -------------------------------- ### Install Python Module Source: https://github.com/opencog/atomspace/blob/master/examples/type-system/demo-types/CMakeLists.txt Installs the compiled 'chempydemo' Python module into the Python site-packages directory. This step is conditional on Python being enabled for the build. ```cmake IF (HAVE_PYTHON) INSTALL(TARGETS chempydemo DESTINATION "${PYTHON_DEST}" ) ENDIF (HAVE_PYTHON) ```