Coder Social home page Coder Social logo

opencog / atomspace Goto Github PK

View Code? Open in Web Editor NEW
779.0 85.0 225.0 165.85 MB

The OpenCog (hyper-)graph database and graph rewriting system

Home Page: https://wiki.opencog.org/w/AtomSpace

License: Other

Scheme 32.57% Shell 0.16% Python 1.94% C 0.05% CMake 3.41% C++ 58.82% Haskell 1.06% GDB 0.01% TeX 0.51% Cython 1.42% OCaml 0.04%
graph-database knowledge-representation query-engine logic-programming knowledge-graph knowledge-base query-language relational-database relational-algebra rewrite-system

atomspace's Introduction

OpenCog AtomSpace

CircleCI

The OpenCog AtomSpace is an in-RAM knowledge representation (KR) database with an associated query engine and graph-re-writing system. It is a kind of in-RAM generalized hypergraph (metagraph) database. Metagraphs offer more efficient, more flexible and more powerful ways of representing graphs: a metagraph store is literally just-plain better than a graph store. On top of this, the Atomspace provides a large variety of advanced features not available anywhere else.

The AtomSpace is a platform for building Artificial General Intelligence (AGI) systems. It provides the central knowledge representation component for OpenCog. As such, it is a fairly mature component, on which a lot of other systems are built, and which depend on it for stable, correct operation in a day-to-day production environment.

There are several dozen modules built on top of the AtomSpace. Notable ones include:

Data as MetaGraphs

It is now commonplace to represent data as graphs; there are more graph databases than you can shake a stick at. What makes the AtomSpace different? A dozen features that no other graph DB does, or has even dreamed of doing.

But, first: five things everyone else does:

  • Perform graphical database queries, returning results that satisfy a provided search pattern.
  • Arbitrarily complex patterns with an arbitrary number of variable regions can be specified, by unifying multiple clauses.
  • Modify searches with conditionals, such as "greater than", and with user callbacks into scheme, python or Haskell.
  • Perform graph rewriting: use search results to create new graphs.
  • Trigger execution of user callbacks... or of executable graphs (as explained below).

A key difference: the AtomSpace is a metagraph store, not a graph store. Metagraphs can efficiently represent graphs, but not the other way around. This is carefully explained here, which also gives a precise definition of what a metagraph is, and how it is related to a graph. As a side-effect, metagraphs open up many possibilities not available to ordinary graph databases. These are listed below. Things are things that no one else does:

  • Search queries are graphs. (The API to the pattern engine is a graph.) That is, every query, every search is also a graph. That means one can store a collection of searches in the database, and access them later. This allows a graph rule engine to be built up.
  • Inverted searches. (DualLink.) Normally, a search is like "asking a question" and "getting an answer". For the inverted search, one "has an answer" and is looking for all "questions" for which its a solution. This is pattern recognition, as opposed to pattern search. All chatbots do this as a matter of course, to handle chat dialog. No chatbot can host arbitrary graph data, or search it. The AtomSpace can. This is because queries are also graphs, and not just data.
  • Both "meet" and "join" searches are possible: One can perform a "fill in the blanks" search (a meet, with MeetLink) and one can perform a "what contains this?" search (a join, with JoinLink.)
  • Graphs are executable. Graph vertex types include "plus", "times", "greater than" and many other programming constructs. The resulting graphs encode "abstract syntax trees" and the resulting language is called Atomese. It resembles the intermediate representation commonly found in compilers, except that, here, its explicitly exposed to the user as a storable, queriable, manipulable, executable graph.
  • Graphs are typed (TypeNode and type constructors.) Graph elements have types, and there are half a dozen type constructors, including types for graphs that are functions. This resembles programming systems that have type constructors, such as CaML or Haskell.
  • Graph nodes carry vectors Values are mutable vectors of data. Each graph element (vertex or edge, node or link) can host an arbitrary collection of Values. This is, each graph element is also a key-value database.
  • Graphs specify flows Values can be static or dynamic. For the dynamic case, a given graph can be thought of as "pipes" or "plumbing"; the Values can "flow" along that graph. For example, the FormulaStream allows numeric vector operations ("formulas") to be defined. Accessing a FormulaStream provides the vector value at that instant.
  • Unordered sets (UnorderedLink.) A graph vertex can be an unordered set (Think of a list of edges, but they are not in any fixed order.) When searching for a matching pattern, one must consider all permutations of the set. This is easy, if the search has only one unordered set. This is hard, if they are nested and inter-linked: it becomes a constraint-satisfaction problem. The AtomSpace pattern engine handles all of these cases correctly.
  • Alternative sub-patterns (ChoiceLink.) A search query can include a menu of sub-patterns to be matched. Such sets of alternatives can be nested and composed arbitrarily. (i.e. they can contain variables, etc.)
  • Globby matching (GlobNode.) One can match zero, one or more subgraphs with globs This is similar to the idea of globbing in a regex. Thus, a variable need not be grounded by only one subgraph: a variable can be grounded by an indeterminate range of subgraphs.
  • Quotations (QuoteLink.) Executable graphs can be quoted. This is similar to quotations in functional programming languages. In this case, it allows queries to search for other queries, without triggering the query that was searched for. Handy for rule-engines that use rules to find other rules.
  • Negation as failure (AbsentLink.) Reject matches to subgraphs having particular sub-patterns in them. That is, find all graphs of some shape, except those having these other sub-shapes.
  • For-all predicate (AlwaysLink.) Require that all matches contain a particular subgraph or satisfy a particular predicate. For example: find all baskets that have only red balls in them. This requires not only finding the baskets, making sure they have balls in them, but also testing each and every ball in a basket to make sure they are all of the same color.
  • Frames (ChangeSets) Store a sequence of graph rewrites, changes of values as a single changeset. The database itself is a collection of such changesets or "Frames". Very roughly, a changeset resembles a git commit, but for the graph database. The word "Frame" is mean to invoke the idea of a stackframe, or a Kripke frame: the graph state, at this moment. By storing frames, it is possible to revert to earlier graph state. It is possible to compare different branches and to explore different rewrite histories starting from the same base graph. Different branches may be merged, forming a set-union of thier contents. This is useful for inference and learning algos, which explore long chains of large, complex graph rewrites.

What it Isn't

Newcomers often struggle with the AtomSpace, because they bring preconceived notions of what they think it should be, and its not that. So, a few things it is not.

  • It's not JSON. So JSON is a perfectly good way of representing structured data. JSON records data as key:value pairs, arranged hierarchically, with braces, or as lists, with square brackets. The AtomSpace is similar, except that there are no keys! The AtomSpace still organizes data hierarchically, and provides lists, but all entries are anonymous, nameless. Why? There are performance (CPU and RAM usage) and other design benefits in not using explicit named keys in the data structure. You can still have named values; it is just that they are not required. There are several different ways of importing JSON data into the AtomSpace. If your mental model of "data" is JSON, then you will be confused by the AtomSpace.

  • It's not SQL. It's also not noSQL. Databases from 50 years ago organized structured data into tables, where the key is the label of a column, and different values sit in different rows. This is more efficient than JSON, when you have many rows: you don't have to store the same key over and over again, for each row. Of course, tabular data is impractical if you have zillions of tables, each with only one or two rows. That's one reason why JSON was invented. The AtomSpace was designed to store unstructured data. You can still store structured data in it; there are several different ways of importing tabular data into the AtomSpace. If your mental model of "data" is structured data, then you will be confused by the AtomSpace.

  • It's not a vertex+edge store. (Almost?) all graph databases decompose graphs into lists of vertexes and edges. This is just fine, if you don't use complex algorithms. The problem with this storage format is locality: graph traversal becomes a game of repeatedly looking up a specific vertex and then, a specific edge, each located in a large table of vertexes and edges. This is non-local; it requires large indexes on those tables (requires a lot of RAM), and the lookups are CPU consuming. Graph traversal can be a bottleneck. The AtomSpace avoids much of this overhead by using (hyper-/meta-)graphs. This enables more effective and simpler traversal algorithms, which in turn allows more sophisticated search features to be implemented. If your mental model of graph data is lists of vertexes and edges, then you will be confused by the AtomSpace.

What is it, then? Most simply, the AtomSpace stores immutable, globally unique, typed s-expressions. The types can be thought of as being like object-oriented classes, and many (not all) Atom types do have a corresponding C++ class. Each s-expression is called "an Atom". Each Atom is globally unique: there is only one copy, ever, of any given s-expression (Atom). It's almost just that simple, with only one little twist: a (mutable) key-value database is attached to each Atom. Now, "ordinary" graph databases do this too: every vertex or edge can have "attributes" on it. The AtomSpace allows these attributes to be dynamic: to change in time or to "flow". The flow itself is described by a graph; thus, graphs can be thought of as "plumbing"; whereas the Values are like the "fluid" in these pipes. This is much like the distinction between "software" and "data": software describes algos, data is what moves through them. In the AtomSpace, the algos are explicit graphs. The Values are the data.

The AtomSpace borrows ideas and concepts from many different systems, including ideas from JSON, SQL and graph stores. The goal of the AtomSpace is to be general: to allow you to work with whatever style of data you want: structured or unstructured. As graphs, as tables, as objects. As lambda expressions, as abstract syntax trees, as prolog-like logical statements. A place to store relational data obeying some relational algebra. As a place to store ontologies or mereologies or taxonomies. A place for syntactic (BNF-style) productions or constraints or RDF/OWL-style schemas. In a mix of declarative, procedural and functional styles. The AtomSpace is meant to allow general knowledge representation, in any format.

The "special extra twist" of immutable graphs decorated with mutable values resembles a corresponding idea in logic: the split between logical statements, and the truth values (valuations) attached to them. This is useful not only for logic, but also for specifying data processing pipelines: the graph specifies the pipeline; the values are what flow through that pipeline. The graph is the "code"; the values are the data that the code acts on.

All this means that the AtomSpace is different and unusual. It might be a bit outside of the comfort zone for most programmers. It doesn't have API's that are instantly recognizable to users of these other systems. There is a challenging learning curve involved. We're sorry about that: if you have ideas for better API's that would allow the AtomSpace to look more conventional, and be less intimidating to most programmers, then contact us!

Status and Invitation

As it turns out, knowledge representation is hard, and so the AtomSpace has been (and continues to be) a platform for active scientific research on knowledge representation, knowledge discovery and knowledge manipulation. If you are comfortable with extremely complex mathematical theory, and just also happen to be extremely comfortable writing code, you are invited -- encouraged -- to join the project.

Related ideas

A short list of some related concepts:

  • Carnegie Mellon Binary Analysis Platforrm (BAP) allows binary programs (viruses, etc.) to be disassembled and analyzed. The disassembled program is stored as a graph in a database. The graph can be analyzed, investigated, and even executed, to see what it does. Thus, similar to the AtomSpace, but very highly specialized for binaries, and nothing else.

  • Modelica is a modelling language for describing complex systems. Intended for describing mechanical, electrical, electronic, hydraulic, thermal, control, electric power and process-oriented systems. The descriptions are static, object-oriented, file-based, and meant to be written by humans. That is, the models are atomated, but not the creation and management of them. Not suitable for general graph structures.

  • The concept of graph programming.

Using Atomese and the AtomSpace

The AtomSpace is not an "app". Rather, it is a knowledge-base platform. It is probably easiest to think of it as kind-of-like an operating system kernel: you don't need to know how it works to use it. You probably don't need to tinker with it. It just works, and it's there when you need it.

End-users and application developers will want to use one of the existing "app" subsystems, or write their own. Most of the existing AtomSpace "apps" are focused on various aspects of "Artificial General Intelligence". This includes (unsupervised) natural-language learning, machine-learning, reasoning and induction, chatbots, robot control, perceptual subsystems (vision processing, sound input), genomic and proteomic data analysis, deep-learning neural-net interfaces. These can be found in other github repos, including:

Zombie projects: these are half-dead; no one is currently working on them, but they should still work and still provide useful capabilities.

Dead projects: these are no longer maintained. They used to work, but have been abandoned for various theoretical and political reasons:

Examples, Documentation, Blog

If you are impatient, a good way to learn the AtomSpace is to run the example demos. Start with these. Then move on to the pattern-matcher examples.

Documentation is on the OpenCog wiki. Good places to start are here:

The OpenCog Brainwave blog provides reading material for what this is all about, and why.

A Theoretical Overview

The AtomSpace is a mashup of a large variety of concepts from mathematical logic, theorem proving, graph theory, database theory, type theory, model theory and knowledge representation. Its hard to provide a coherent overview without throwing around a lot of "big words" and "big concepts". We're trying to get a lot of things done, here, and there's no particularly simple or effective way of explaining it without a lot of foundational theory.

Atom Types

There are pre-defined Atoms for many basic knowledge-representation and computer-science concepts. These include Atoms for relations, such as similarity, inheritance and subsets; for logic, such as Boolean and, or, for-all, there-exists; for Bayesian and other probabilistic relations; for intuitionist logic, such as absence and choice; for parallel (threaded) synchronous and asynchronous execution; for expressions with variables and for lambda expressions and for beta-reduction and mapping; for uniqueness constraints, state and a messaging "blackboard"; for searching and satisfiability and graph re-writing; for the specification of types and type signatures, including type polymorphism and type construction. See Atom types.

Atomese

Because of these many and varied Atom types, constructing graphs to represent knowledge looks kind-of-like "programming"; the programming language is informally referred to as "Atomese". It vaguely resembles a strange mash-up of SQL (due to queriability), prolog/datalog (due to the logic and reasoning components), lisp/scheme (due to lambda expressions), Haskell/CaML (due to the type system) and rule engines (due to the graph rewriting and forward/backward chaining inference systems). This "programming language" is NOT designed for use by human programmers (it is too verbose and awkward for that); it is designed for automation and machine learning. That is, like any knowledge representation system, the data and procedures encoded in "Atomese" are meant to be accessed by other automated subsystems manipulating and querying and inferencing over the data/programs. See Atomese.

Aside from the various advanced features, Atomese also has some very basic and familiar atom types: atoms for arithmetic operations like "plus" and "times", conditional operators, like "greater-than" or "equals", control operations like "sequential and" and "cond", as well as settable state. This makes Atomese resemble a kind of intermediate language, something you might find inside of a compiler, a bit like CIL or Gimple. However, it is both far more flexible and powerful than these, and also far less efficient. Adventurous souls are invited to create a compiler to GNU Lighting, CIL, Java bytecode or the bytecode of your choice; or maybe to a GPU backend, or even more complex data-processing systems, such as TensorFlow.

In its current form, Atomese was primarily designed to allow the generalized manipulation of large networks of probabilistic data by means of rules and inferences and reasoning systems. It extends the idea of probabilistic logic networks to a generalized system for algorithmically manipulating and managing data. The current, actual design has been heavily influenced by practical experience with natural-language processing, question answering, inferencing and the specific needs of robot control.

The use of the AtomSpace, and the operation and utility of Atomese, remains a topic of ongoing research and design experimentation, as various AI and knowledge-processing subsystems are developed. These include machine learning, natural language processing, motion control and animation, deep-learning networks and vision processing, constraint solving and planning, pattern mining and data mining, question answering and common-sense systems, and emotional and behavioral psychological systems. Each of these impose sharply conflicting requirements on the AtomSpace architecture; the AtomSpace and "Atomese" is the current best-effort KR system for satisfying all these various needs in an integrated way. It is likely to change, as the various current short-comings, design flaws, performance and scalability issues are corrected.

Active researchers and theoreticians are invited to join! The current codebase is finally clean and well-organized enough that a large number of possibilities have opened up, offering many different and exciting directions to pursue. The system is clean and flexible, and ready to move up to the next level.

Atoms and Values

One of the primary conceptual distinctions in Atomese is between "Atoms" and "Values". The distinction is made for both usability and performance. Atoms are:

  • Used to represent graphs, networks, and long-term stable graphical relations.
  • Indexed (by the AtomSpace), which enables the rapid search and traversal of graphs.
  • Globally unique, and thus unambiguous anchor points for data.
  • Immutable: can only be created and destroyed, and are effectively static and unchanging.
  • Large, bulky, heavy-weight (because indexes are necessarily bulky).

By contrast, Values, and valuations in general, are:

  • A way of holding on to rapidly-changing data, including streaming data.
  • Hold "truth values" and "probabilities", which change over time as new evidence is accumulated.
  • Provide a per-Atom key-value store (a mini noSQL database per-Atom).
  • Are not indexed, and are accessible only by direct reference.
  • Small, fast, fleeting (no indexes!)

Thus, for example, a piece of knowledge, or some proposition would be stored as an Atom. As new evidence accumulates, the truth value of the proposition is adjusted. Other fleeting changes, or general free-form annotations can be stored as Values. Essentially, the AtomSpace looks like a database-of-databases; each atom is a key-value database; the atoms are related to one-another as a graph. The graph is searchable, editable; it holds rules and relations and ontologies and axioms. Values are the data that stream and flow through this network, like water through pipes. Atoms define the pipes, the connectivity. Values flow and change. See the blog entry value flows as well as Atom and Value.

More info

The primary documentation for the atomspace and Atomese is here:

The main project site is at https://opencog.org

New Developers; Pre-requisite skills

Most users should almost surely focus their attention on one of the high-level systems built on top of the AtomSpace. The rest of this section is aimed at anyone who wants to work inside of the AtomSpace.

Most users/developers should think of the AtomSpace as being kind-of-like an operating system kernel, or the guts of a database: its complex, and you don't need to know how the innards work to use the system. These innards are best left to committed systems programmers and research scientists; there is no easy way for junior programmers to participate, at least, not without a lot of hard work and study. Its incredibly exciting, though, if you know what you're doing.

The AtomSpace is a relatively mature system, and thus fairly complex. Because other users depend on it, it is not very "hackable"; it needs to stay relatively stable. Despite this, it is simultaneously a research platform for discovering the proper way of adequately representing knowledge in a way that is useful for general intelligence. It turns out that knowledge representation is not easy. This project is a -good- excellent place to explore it, if you're interested in that sort of thing.

Experience in any of the following areas will make things easier for you; in fact, if you are good at any of these ... we want you. Bad.

  • Database internals; query optimization.
  • Logic programming; Prolog.
  • SAT-solving; Answer Set programming; Satisfiability Modulo Theories.
  • Programming language design & implementation.
  • Rule engines; reasoning; inference; parsing.
  • Theorem-proving systems; Type theory.
  • Compiler internals; code generation; code optimization; bytecode; VM's.
  • Operating systems; distributed database internals.
  • GPU processing pipelines, lighting-shading pipelines, CUDA, OpenCL.
  • Dataflow in GPU's for neural networks.

Basically, Atomese is a mash-up of ideas taken from all of the above fields. It's kind-of trying to do and be all of these, all at once, and to find the right balance between all of them. Again: the goal is knowledge representation for general intelligence. Building something that the AGI developers can use.

We've gotten quite far; we've got a good, clean code-base, more-or-less, and we're ready to kick it to the next level. The above gives a hint of the directions that are now open and ready to be explored.

If you don't have at least some fair grounding in one of the above, you'll be lost, and find it hard to contribute. If you do know something about any of these topics, then please dive into the open bug list. Fixing bugs is the #1 best way of learning the internals of any system.

Key Development Goals

Looking ahead, some key major projects.

Distributed Processing

One of the development goals for the 2021-2023 time frame is to gain experience with distributed data processing. Currently, one can build simple distributed networks of AtomSpaces, by using the StorageNode to specify a remote AtomSpace. However, it is up to you as to what kinds of data these AtomSpace exchange with one-another. Only two simple pre-configured communications styles have been created: the read-thru and the write-thru proxies for the cogserver. These pass incoming data and results on to the next nodes in the network.

Cross-system Bridges

Because the AtomSpace can hold many different representatioinal styles, it is relatively easy to import data into the AtomSpace. The low-brow way to do this is to write a script file that imports the data. This is fine, but leads to data management issues: who's got the master copy?

The goal of data bridges is to create new Atoms that allow live access into other online systems. For example, if an SQL database holds a table of (name, address, phone-number), it should be possible to map this into the AtomSpace, such that updates not only alter the SQL table, live and on line, but also such that a query performed on the AtomSpace side translates into a query on the SQL database side. This is not hard to do, but no one's done it yet.

Similarly, a live online bridge between the AtomSpace and popular graph databases should also be possible. It's not clear if this should use the StorageNode API mentioned above, or if it needs something else.

Exploring Values

The new Value system seems to provide a very nice way of working with fast-moving high-frequency data. It seems suitable for holding on to live-video feeds and audio streams and piping them through various data-processing configurations. It looks to be a decent API for declaring the structure and topology of neural nets (e.g. TensorFlow). However, it is more-or-less unused for these tasks. Apparently, there is still some missing infrastructure, as well as some important design decisions to be made. Developers have not begun to explore the depth and breadth of this subsystem, to exert pressure on it. Ratcheting up the tension by exploring new and better ways of using and working with Values will be an important goal for the 2021-2024 time-frame. See the value flows blog entry.

A particularly important first step would be to build interfaces between values and an audio DSP framework. This would allow AtomSpace structures to control audio processing, thus enabling (for example) sound recognition (do I hear clapping? Cheers? Boos?) without having to hard-code a "cheer recognizer". This opens the door to using machine learning to learn how to detect different kinds of audio events.

There is no particular need to limit oneself to audio: other kinds of data is possible (e.g. exploring the syntactic, hierarchical part-whole structure in images) but audio is perhaps easier!?

Sheaf theory

Many important types of real-world data, include parses of natural language and biochemical processes resemble the abstract mathematical concept of "sheaves", in the sense of sheaf theory. One reason that things like deep learning and neural nets work well is because some kinds of sheaves look like tensor algebras; thus one has things like Word2Vec and SkipGram models. One reason why neural nets still stumble on natural language processing is because natural language only kind-of-ish, partly looks like a tensor algebra. But natural language looks a whole lot more like a sheaf (because things like pre-group grammars and categorial grammars "naturally" look like sheaves.) Thus, it seems promising to take the theory and all the basic concepts of deep learning and neural nets, rip out the explicit tensor-algebra in those theories, and replace them by sheaves. A crude sketch is here.

Some primitive, basic infrastructure has been built. Huge remaining work items are using neural nets to perform the tensor-like factorization of sheaves, and to redesign the rule engine to use sheaf-type theorem proving techniques.

Current work is split between two locations: the "sheaf" subdirectory in this repo, and the generate repo.

Building and Installing

The Atomspace runs on more-or-less any flavor of GNU/Linux. It does not run on any non-Linux operating systems (except maybe some of the BSD's). Sorry!

There are a small number of pre-requisites that must be installed before it can be built. Many users will find it easiest to use the install scripts provided in the ocpkg repo. Some users may find some success with one of the opencog Docker containers. Developers interested in working on the AtomSpace must be able to build it manually. If you can't do that, all hope is lost.

Prerequisites

To build the OpenCog AtomSpace, the packages listed below are required. Essentially all Linux distributions will provide these packages.

boost
cmake
cogutil
guile
cxxtest
  • Unit test framework.
  • Required for running unit tests. Breaking unit tests is verboten!
  • https://cxxtest.com/ | apt install cxxtest

Optional Prerequisites

The following packages are optional. If they are not installed, some optional parts of the AtomSpace will not be built. The cmake command, during the build, will be more precise as to which parts will not be built.

Cython
  • C bindings for Python. (Cython version 0.23 or newer)
  • Recommended, as many users enjoy using python.
  • https://cython.org | apt install cython
Haskell
OCaml
  • OCaml bindings (experimental).
  • Optional; almost no existing code makes use of OCaml.
  • https://www.ocaml.org/ | apt install ocaml ocaml-findlib
Postgres
  • Distributed, multi-client networked storage.
  • Needed for "remembering" between shutdowns (and for distributed AtomSpace)
  • Optional; The RocksDB backend is recommended. Use the cogserver to get a distributed atomspace.
  • https://postgres.org | apt install postgresql postgresql-client libpq-dev

Building AtomSpace

Be sure to install the pre-requisites first! Perform the following steps at the shell prompt:

    cd to project root dir
    mkdir build
    cd build
    cmake ..
    make -j4
    sudo make install
    make -j4 check

Libraries will be built into subdirectories within build, mirroring the structure of the source directory root.

Unit tests

To build and run the unit tests, from the ./build directory enter (after building opencog as above):

    make -j4 check

Most tests (just not the database tests) can be run in parallel:

    make -j4 check ARGS=-j4

The database tests will fail if run in parallel: they will step on one-another, since they all set and clear the same database tables.

Specific subsets of the unit tests can be run:

    make test_atomese
    make test_atomspace
    make test_guile
    make test_join
    make test_matrix
    make test_persist_sql
    make test_python
    make test_query

Install

After building, you MUST install the atomspace.

    sudo make install

Writing Atomese

Atomese -- that is -- all of the different Atom types, can be thought of as the primary API to the AtomSpace. Atoms can, of course, be created and manipulated with Atomese; but, in practice, programmers will work with either Scheme (guile), Python, C++, OCaml or Haskell.

The simplest, most complete and extensive interface to Atoms and the Atomspace is via scheme, and specifically, the GNU Guile scheme implementation. An extensive set of examples can be found in the /examples/atomspace and the /examples/pattern-matcher directories.

Python is more familiar than scheme to most programmers, and it offers another way of interfacing to the atomspace. Unfortunately, it is not as easy and simple to use as scheme; it also has various technical issues. Thus, it is significantly less-used than scheme in the OpenCog project. None-the-less, it remains vital for various applications. See the /examples/python directory for how to use python with the AtomSpace.

TODO - Notes - Open Projects

atomspace's People

Contributors

alex-van-der-peet avatar amebel avatar czhedu avatar edajade avatar ferrouswheel avatar githart avatar huangdeheng avatar inflector avatar jswiergo avatar kasimebrahim avatar keyvan-m-sadeghi avatar kizzobot avatar leungmanhin avatar linas avatar marcospividori avatar misgeatgit avatar ngeiswei avatar noskill avatar rekino avatar rtreutlein avatar sebastianruder avatar shujingke avatar stellarspot avatar themixed avatar timothywangdev avatar tnick avatar tpsjr7 avatar vsbogd avatar williampma avatar xiaohui avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atomspace's Issues

Fail to find the HyperTable library in cmake

Hello,

When I'm trying to cmake, I'm getting the following error even I installed HyperTable library.

"Hypertable not found; the experimental distributed persistence DB needs it."

After finding cause of this problem, I can build with successfully when I changed to content of lib/FindHyperTable.cmake

FIND_LIBRARY(HYPER_DFS_BROKER NAMES HyperDfsBroker PATHS ${HYPER_LIB_PATHS})
to
FIND_LIBRARY(HYPER_DFS_BROKER NAMES HyperFsBroker PATHS ${HYPER_LIB_PATHS})

HyperDfsBroker to HyperFsBroker works with me, but I'm not sure why name of library in HyperTable is different.

I'm using Ubuntu 14.04 LTS x64 and I installed HyperTable library by aptitude. Version of library is 0.9.8.4.

Thanks,
DongMin

Can't make guile example work

I'm trying to follow what is described in

atomspace/examples/guile/README.md

but I'm getting the following error

nilg@laptop:~/OpenCog/atomspace/examples/guile$ guile
GNU Guile 2.0.9
Copyright (C) 1995-2013 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (add-to-load-path "/usr/local/share/opencog/scm")
scheme@(guile-user)> (add-to-load-path ".")
scheme@(guile-user)> (use-modules (ice-9 readline))
scheme@(guile-user)> (activate-readline)
scheme@(guile-user)> (use-modules (opencog))
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /usr/local/share/opencog/scm/opencog.scm
;;; opencog.scm:22:0: warning: possibly unbound variable `cog-set-atomspace!'
;;; opencog.scm:22:20: warning: possibly unbound variable `cog-new-atomspace'
;;; compiled /home/nilg/.cache/guile/ccache/2.0-LE-8-2.0/usr/local/share/opencog/scm/opencog.scm.go
While compiling expression:
ERROR: In procedure dynamic-link: file: "libsmob", message: "file not found"

PatternLink::setup_components is likely buggy

There is probably something wrong with PatternLink::setup_components, to see why you may do as follows

*1. Add the followning at l.93 of opencog/atoms/bind/PatternLink.cc

        std::cout << "PatternLink::setup_components h = " << h << std::endl;

in PatternLink::setup_components' loop after the definition of h.

*2. Run any pattern matcher example from examples/pattern-matcher, or any rule-engine example, you may see that h is always UNDEFINED.

That cannot be right, right? I think the problem is that the created patternLink is not added to the AtomSpace so no Handle can be associated to it. I'm not sure it should be added to atomspace, so maybe the solution is to have _component_patterns take PatternLinkPtrs instead of Handles.

Make rule implicand explicit for the backward chainer

The backward chainer needs to know the structure of its implicand in order to select the applicable rules of a target. The problem is that given the way rules are currently represented, the implicand does not need to be explicit. Given the following format

BindLink
   AndLink
      <Implicant>
   <Implicand>

Implicand is usually hidden in an ExecutionOutputLink like

ExecutionOutputLink
   "scm:compute-the-implicand"
   ListLink
      ARG1 ... ARGn

Currently the backward chainer looks at ARG1 to ARGn to guess the implicand, but nothing guaranties that this guess is correct, ARG1 to ARGn may turn out not to represent the implicand at all. Besides, even when the implicand is in there, the rule is harder to filter due to the other arguments which are not the implicand (@williampma correct me if I'm wrong).

We need to set an additional constraint on the rule format to make the implicand explicit. I think ideally we'd use a SetTVLink, see below.

Let's assume SetTVLink has the following format

SetTVLink
   <Atom>
   <TV>

So this would assign to . It's not clear what should be, it could be a TVLink that takes 2 NumberNode arguments, or something like that, anyway.

The rule would have the following format

BindLink
   <Variables> (optional)
   <Implicants>
   SetTVLink
      <Implicand>
      <TV>

For instance a deduction rule would look like

BindLink
   AndLink
      ImplicationLink
         VariableNode "$A"
         VariableNode "$B"
      ImplicationLink
         VariableNode "$B"
         VariableNode "$C"
   SetTVLink
      ImplicationLink
         VariableNode "$A"
         VariableNode "$C"
      ExecutionOutputLink
         GroundedSchemaNode "scm:deduction-formula"
         ListLink
            ImplicationLink
               VariableNode "$A"
               VariableNode "$B"
            ImplicationLink
               VariableNode "$B"
               VariableNode "$C"

the scheme code deduction-formula would still need to take Implication(A B) and Implication(B C) to get their TVs and compute the TV of Implication(A C).

If we don't want to wait for SetTVLink, we could still use that format replacing SetTVLink by ExecutionOutputLink + some scheme code, like

BindLink
   AndLink
      ImplicationLink
         VariableNode "$A"
         VariableNode "$B"
      ImplicationLink
         VariableNode "$B"
         VariableNode "$C"
   ExecutionOutputLink
      GroundedSchemaNode "scm:set-tv"
      ListLink
         ImplicationLink
            VariableNode "$A"
            VariableNode "$C"
         ExecutionOutputLink
            GroundedSchemaNode "scm:deduction-formula"
            ListLink
               ImplicationLink
                  VariableNode "$A"
                  VariableNode "$B"
               ImplicationLink
                  VariableNode "$B"
                  VariableNode "$C"

Slightly more verbose but allows to move on without having to define SetTVLink. Although I think taking the time to implement Set/Get TV links would be a good thing.

Also in both cases we could define some scheme function to build the BindLink given the rule's implicants, implicand and formula code. Or maybe store it that way, and let the URE build the BindLink as appropriate.

PatternMatcherCallBack grounding var_soln corrupted?

This one is tough. Need to write some custom code to test this.

First, assume the following are in the AtomSpace

(EvaluationLink
   (PredicateNode "chirps")
   (ConceptNode "Tweety")
)
(EvaluationLink
   (PredicateNode "eats_flies")
   (ConceptNode "Tweety")
)
(InheritanceLink
   (ConceptNode "Tweety")
   (ConceptNode "Yello")
)
(BindLink (av 0 0 0)
   (VariableList (av 0 0 0)
      (VariableNode "$A")
      (VariableNode "$B")
   )
   (AndLink
      (VariableNode "$A")
      (ImplicationLink
         (VariableNode "$A")
         (VariableNode "$B")
      )
   )
   (ExecutionOutputLink
      (GroundedSchemaNode "scm: pln-formula-simple-modus-ponens")
      (ListLink
         (VariableNode "$B")
         (ImplicationLink
            (VariableNode "$A")
            (VariableNode "$B")
         )
      )
   )
)
(ListLink
   (InheritanceLink
      (ConceptNode "Fritz")
      (ConceptNode "green")
   )
   (ImplicationLink
      (InheritanceLink
         (ConceptNode "Fritz")
         (ConceptNode "Frog")
      )
      (InheritanceLink
         (ConceptNode "Fritz")
         (ConceptNode "green")
      )
   )
)
(ListLink
   (InheritanceLink
      (ConceptNode "Fritz")
      (ConceptNode "Frog")
   )
   (ImplicationLink
      (AndLink
         (EvaluationLink
            (PredicateNode "croaks")
            (ConceptNode "Fritz")
         )
         (EvaluationLink
            (PredicateNode "eats_flies")
            (ConceptNode "Fritz")
         )
      )
      (InheritanceLink
         (ConceptNode "Fritz")
         (ConceptNode "Frog")
      )
   )
)
(ImplicationLink
   (AndLink
      (EvaluationLink
         (PredicateNode "chirps")
         (VariableNode "$Y")
      )
      (EvaluationLink
         (PredicateNode "sings")
         (VariableNode "$Y")
      )
   )
   (InheritanceLink
      (VariableNode "$Y")
      (ConceptNode "Canary")
   )
)
(ImplicationLink
   (AndLink
      (EvaluationLink
         (PredicateNode "croaks")
         (VariableNode "$X")
      )
      (EvaluationLink
         (PredicateNode "eats_flies")
         (VariableNode "$X")
      )
   )
   (InheritanceLink
      (VariableNode "$X")
      (ConceptNode "Frog")
   )
)
(ImplicationLink
   (InheritanceLink
      (VariableNode "$Z")
      (ConceptNode "Frog")
   )
   (InheritanceLink
      (VariableNode "$Z")
      (ConceptNode "green")
   )
)
(ImplicationLink
   (InheritanceLink
      (VariableNode "$A")
      (ConceptNode "Canary")
   )
   (InheritanceLink
      (VariableNode "$A")
      (ConceptNode "yellow")
   )
)

Then, write a new PatternMatcherCallBack with a new grounding method that just print the var_soln mapping

bool NewPMCB::grounding(const std::map<Handle, Handle> &var_soln,
                               const std::map<Handle, Handle> &pred_soln)
{
    for (auto& p : var_soln)
        logger().debug("var_soln map " + p.first->toShortString() + " to " + p.second->toShortString());

    return false;
}

Then have some variable Handle htarget then contains the following additional atom

(AndLink (stv 1.000000 0.000000)
  (InheritanceLink (stv 1.000000 0.000000)
    (VariableNode "$Z") ; [142]
    (ConceptNode "Frog") ; [115]
  ) ; [150]
  (ImplicationLink (stv 1.000000 0.000000)
    (InheritanceLink (stv 1.000000 0.000000)
      (VariableNode "$Z") ; [142]
      (ConceptNode "Frog") ; [115]
    ) ; [150]
    (InheritanceLink (stv 1.000000 0.000000)
      (VariableNode "$Z") ; [142]
      (ConceptNode "green") ; [113]
    ) ; [151]
  ) ; [152]
) ; [477]

And call the Pattern Matcher code like this

    // Get all VariableNodes (unquoted)
    FindAtoms fv(VARIABLE_NODE);
    fv.search_set(htarget);

    HandleSeq vars;
    for (auto& h : fv.varset)
        vars.push_back(h);

    Handle htarget_vardecl = _as->addAtom(createVariableList(vars));

    PatternLinkPtr sl(createPatternLink(htarget_vardecl, htarget));
    NewPMCB pmcb(_as);

    logger().debug("Before patterm matcher");

    sl->satisfy(pmcb);

    logger().debug("After running pattern matcher");

cogserver crash at the line printing var_soln (in particular, when printing p.second. Printing p.first was fine).

In my case, the crash code is like this

[2015-06-04 04:18:41:696] [ERROR] Caught signal 11 (Segmentation fault) on thread 140051551868672
    Stack Trace:
    2: basic_string.h:539   ~basic_string()
    3: CogServerMain.cc:79  _Z7sighandi()
    4: ??:0 killpg()
    5: BackwardChainerPMCB.cc:57      opencog::BackwardChainerPMCB::grounding(std::map<opencog::Handle, opencog::Handle, std::less<opencog::Handle>, std::allocator<std::pair<opencog::Handle const, opencog::Handle> > > const&, std::map<opencog::Handle, opencog::Handle, std::less<opencog::Handle>, std::allocator<std::pair<opencog::Handle const, opencog::Handle> > > const&)
    6: PatternMatchEngine.cc:1295     opencog::PatternMatchEngine::do_next_clause()
    7: PatternMatchEngine.cc:1104     opencog::PatternMatchEngine::do_term_up(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    8: PatternMatchEngine.cc:1048     opencog::PatternMatchEngine::explore_single_branch(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    9: shared_ptr_base.h:545    ~__shared_count()
    10: PatternMatchEngine.cc:1208    opencog::PatternMatchEngine::do_term_up(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    11: PatternMatchEngine.cc:1048    opencog::PatternMatchEngine::explore_single_branch(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    12: PatternMatchEngine.cc:1335    opencog::PatternMatchEngine::do_next_clause()
    13: PatternMatchEngine.cc:1104    opencog::PatternMatchEngine::do_term_up(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    14: PatternMatchEngine.cc:1048    opencog::PatternMatchEngine::explore_single_branch(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    15: shared_ptr_base.h:545   ~__shared_count()
    16: PatternMatchEngine.cc:1208    opencog::PatternMatchEngine::do_term_up(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    17: PatternMatchEngine.cc:1048    opencog::PatternMatchEngine::explore_single_branch(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    18: InitiateSearchCB.cc:286   opencog::InitiateSearchCB::neighbor_search(opencog::PatternMatchEngine*)
    19: InitiateSearchCB.cc:481   opencog::InitiateSearchCB::disjunct_search(opencog::PatternMatchEngine*)
    20: PatternMatch.cc:341   opencog::PatternLink::satisfy(opencog::PatternMatchCallback&) const
    21: BackwardChainer.cc:112    opencog::BackwardChainer::do_until(unsigned int)
    22: InferenceSCM.cc:134   opencog::InferenceSCM::do_backward_chaining(opencog::Handle)
    23: shared_ptr_base.h:545   ~__shared_count()
    24: SchemePrimitive.cc:158    opencog::PrimitiveEnviron::do_call(scm_unused_struct*, scm_unused_struct*)
    25: ??:0    scm_vm_engine()
    26: ??:0    scm_call_1()
    27: ??:0    scm_vm_engine()
    28: ??:0    scm_call_3()
    29: ??:0    scm_vm_engine()
    30: ??:0    scm_call_4()
    31: SchemeEval.cc:606     opencog::SchemeEval::do_eval(std::string const&)
    32: SchemeEval.cc:535     opencog::SchemeEval::c_wrap_eval(void*)
    33: ??:0    scm_at_abort()
    34: ??:0    scm_vm_engine()
    35: ??:0    scm_call_4()
    36: ??:0    scm_at_abort()
    37: ??:0    scm_c_with_continuation_barrier()
    38: ??:0    GC_call_with_gc_active()
    39: ??:0    scm_current_processor_count()
    40: ??:0    GC_call_with_stack_base()
    41: ??:0    scm_with_guile()
    42: SchemeEval.cc:502     opencog::SchemeEval::eval_expr(std::string const&)
    43: basic_string.h:293    std::string::_M_data() const
    44: ??:0      std::this_thread::__sleep_for(std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >)
    45: pthread_create.c:312    start_thread()
    46: clone.S:113 clone()


EinsteinUTest taking too long

Normally, EinsteinUTest runs in 10 seconds, but it is currently running in 300 seconds. This is due to some pattern matcher bug .. this has happened before, and bisection should reveal what the problem is.

Python API: scheme_eval_h not working

After an entirely fresh install and build of opencog/atomspace, Python code using scheme_eval_h that previously ran under the old (February 2015) opencog/opencog build is failing.

Here is a Python test program running against opencog/atomspace that demonstrates that the Atomspace is working and the Python API add_node method is working, while attempting to add a node via scheme_eval_h fails:

from opencog.atomspace import Atom, AtomSpace, TruthValue, types, get_type_name
from opencog.scheme_wrapper import load_scm, scheme_eval, scheme_eval_h, __init__

atomspace = AtomSpace()
__init__(atomspace)

TRUTH_VALUE = TruthValue(1,1000000000)

data = ["opencog/atomspace/core_types.scm",
        "opencog/scm/utilities.scm"]

for item in data:
    load_scm(atomspace, item)

atomspace.add_node(types.ConceptNode, "Object_001",TRUTH_VALUE)
atomspace.add_node(types.ConceptNode, "Object_002",TRUTH_VALUE)

my_nodes = atomspace.get_atoms_by_type(types.ConceptNode)

for i in my_nodes:
        print i

scheme_string = \
    '''
    (ConceptNode "Object_003")
    '''

result = scheme_eval_h(atomspace, scheme_string)

Running that program produced the following errors:

Traceback (most recent call last):
File "/home/jimrutt/PycharmProjects/SchemeEvalTests/SchemeEvalTest001.py", line 23, in
result = scheme_eval_h(atomspace, scheme_string)
File "scheme_wrapper.pyx", line 58, in opencog.scheme_wrapper.scheme_eval_h (/home/jimrutt/atomspace/build/opencog/cython/opencog/scheme_wrapper.cpp:1241)
RuntimeError: Backtrace:
In ice-9/boot-9.scm:
157: 12 [catch #t # ...]
In unknown file:
?: 11 [apply-smob/1 #]
In ice-9/boot-9.scm:
157: 10 [catch #t # ...]
In unknown file:
?: 9 [apply-smob/1 #]
?: 8 [call-with-input-string "(ConceptNode "Object_004")" ...]
In ice-9/boot-9.scm:
2401: 7 [save-module-excursion #<procedure a1e7690 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
44: 6 [read-and-eval #<input: string 9e4dc30> #:lang ...]
37: 5 [lp (ConceptNode "Object_004")]
In ice-9/eval.scm:
386: 4 [eval #<memoized (ConceptNode (quote "Object_004"))> ()]
393: 3 [eval # ()]
In unknown file:
?: 2 [memoize-variable-access! # #<directory # 9f1e630>]
In ice-9/boot-9.scm:
102: 1 [#<procedure a1e5a20 at ice-9/boot-9.scm:97:6 (thrown-k . args)> unbound-variable ...]
In unknown file:
?: 0 [apply-smob/1 # unbound-variable ...]

ERROR: In procedure apply-smob/1:
ERROR: Unbound variable: ConceptNode
ABORT: unbound-variable
(/home/jimrutt/atomspace/opencog/guile/SchemeEval.cc:879)

Enabling DEBUG print in PatternMatchEngine.cc doesn't compile

I'm getting the following error

/home/nilg/OpenCog/atomspace/opencog/query/PatternMatchEngine.cc:569:9: error: ‘perm_count’ was not declared in this scope
         perm_count[Unorder(hp, hg)], num_perms, hp.value(),

and it's not obvious to me what perm_count should be replaced by.

Support executing ungrounded Schemata/Predicates

Disclaimer

I'm writing that based solely on

http://wiki.opencog.org/w/Scheme#cog-execute.21

and

http://wiki.opencog.org/w/ExecutionLink

I didn't try to run cog-execute! to actually see what is or not supported.

Proposal

Given

ExecutionLink
   SchemaNode "S"
   <Inputs>
   <Output>
[1]

and

ExecutionOutputLink
   SchemaNode "S"
   <Inputs>
[2]

If cog-execute! is called on [2] it should return the output defined in [1].

Dealing with Multiple Outputs

If there are more than one output for the same inputs, then it may either

  1. raise an error,
  2. return the distribution of outputs,
  3. or select one according to that distribution.

The distribution would be defined by the TVs on the ExecutionLinks (TVs representing probabilities according to http://wiki.opencog.org/w/OpenCogPrime:FunctionNotation#Execution_Links).

It seems acceptable if, for starter, it simply raises an error. Maybe the other options should be delegated to other functions than cog-execute!.

Motivation Behind the Proposal

That way whether you store a value using an ExecutionLink, a GroundedSchemaNode or a PutLink, the way to obtain it would be almost the same, a call of cog-execute! over an ExecutionOutputLink or GetLink.

Build problem in Ubuntu 14.10

Keep getting opencog/atomspace_api.h: No such file or directory when trying to build atomspace.

Tried all sort of things, removing python3/cython3, also can't seem to find where atomspace_api.h is generated and I did look believe you me :)

Here's what the output looks like:

admin2@ubuntu:~/Documents/atomspace/build$ uname -a
Linux ubuntu 4.1.0-rc4+ #1 SMP Sun May 24 11:52:18 PDT 2015 x86_64 x86_64 x86_64 GNU/Linux

admin2@ubuntu:~/Documents/atomspace/build$ cmake ..
-- Build type: Release
-- Boost version: 1.55.0
-- Found the following Boost libraries:
-- date_time
-- filesystem
-- program_options
-- regex
-- serialization
-- system
-- thread
-- Boost version 105500 found.
-- Found CogUtil version 2.0.1 at /usr/local/lib/libcogutil.so
-- CogUtil found.
-- GHC was found.
-- GSL found.
-- Guile (2.0.11 >= 2.0.0) was found.
-- HyperTable was not found. Make sure HYPERTABLE_LIBRARY and HYPERTABLE_INCLUDE_DIR are set.
-- Hypertable not found; the experimental distributed persistence DB needs it.
-- Python libs found.
-- Cython ( 0.23 >= 0.19.0) found.
-- Python destination dir found: /usr/lib/python2.7/dist-packages

-- Found Intel TBB

-- UnixODBC was found.
-- Valgrind Prefix:
-- Could NOT find VALGRIND (missing: VALGRIND_INCLUDE_DIR VALGRIND_PROGRAM)
-- VALGRIND missing: needed for thread debugging.
-- Found ZeroMQ library: /usr/lib/x86_64-linux-gnu/libzmq.so
-- Detected ZeroMQ version number: 4.0.4
-- ZeroMQ was found.
CMake Warning at tests/persist/sql/CMakeLists.txt:45 (MESSAGE):
/usr/bin/psql: psql: could not connect to server: Connection refused

Is the server running on host "localhost" (127.0.0.1) and accepting

TCP/IP connections on port 5432?

CMake Warning at tests/persist/sql/CMakeLists.txt:60 (MESSAGE):
Postgres database not configured for unit tests! See the README!

The following components will be built:

AtomSpace - A weighted and typed hypergraph database.
Cython bindings - Cython (python) bindings.
Doxygen - Code documentation.
Python tests - Python bindings nose tests.
Scheme bindings - Scheme bindings and shell.
SQL persistance - Save/Restore of AtomSpace to database.
TBB - Intel TBB (Threaded Building Blocks) for multithreading.
Unit tests - Unit tests.

The following components WILL NOT be built:

Hypertable - HyperTable for scalable persistance (experimental).

-- Configuring done
-- Generating done
-- Build files have been written to: /home/admin2/Documents/atomspace/build
admin2@ubuntu:~/Documents/atomspace/build$ make -j6
[ 0%] Cythonizing logger.pyx
[ 2%] [ 2%] [ 4%] [ 4%] [ 6%] Building CXX object lib/json_spirit/CMakeFiles/json_spirit.dir/json_spirit_reader.cpp.o
Generating opencog types
Building CXX object lib/json_spirit/CMakeFiles/json_spirit.dir/json_spirit_value.cpp.o
Building CXX object lib/json_spirit/CMakeFiles/json_spirit.dir/json_spirit_writer.cpp.o
Building CXX object opencog/cython/CMakeFiles/PythonEval.dir/PythonEval.cc.o
-- Atom type name: Notype
-- Atom type name: Atom
-- Atom type name: Node
-- Atom type name: Link
-- Atom type name: ConceptNode
-- Atom type name: NumberNode
-- Atom type name: OrderedLink
-- Atom type name: UnorderedLink
-- Atom type name: SetLink
-- Atom type name: ListLink
-- Atom type name: MemberLink
-- Atom type name: SubsetLink
-- Atom type name: IntensionalInheritanceLink
-- Atom type name: ExtensionalSimilarityLink
-- Atom type name: IntensionalSimilarityLink
-- Atom type name: AndLink
-- Atom type name: OrLink
-- Atom type name: NotLink
-- Atom type name: SequentialAndLink
-- Atom type name: AbsentLink
-- Atom type name: ChoiceLink
-- Atom type name: ContextLink
-- Atom type name: TypeNode
-- Atom type name: TypeChoice
-- Atom type name: VariableNode
-- Atom type name: TypedVariableLink
-- Atom type name: VariableList
-- Atom type name: QuoteLink
-- Atom type name: ScopeLink
-- Atom type name: DefineLink
-- Atom type name: BetaRedex
-- Atom type name: PatternLink
-- Atom type name: GetLink
-- Atom type name: SatisfactionLink
-- Atom type name: BindLink
-- Custom atom type name specified: "ForAllLink"
-- Atom type name: ForAllLink
-- Atom type name: ExistsLink
-- Atom type name: AverageLink
-- Atom type name: SatisfyingSetLink
-- Atom type name: ScholemLink
-- Atom type name: ImplicationLink
-- Atom type name: EquivalenceLink
-- Atom type name: AssociativeLink
-- Atom type name: InheritanceLink
-- Atom type name: SimilarityLink
-- Atom type name: AttractionLink
-- Atom type name: FreeLink
-- Atom type name: PutLink
-- Atom type name: EvaluationLink
-- Atom type name: ExecutionLink
-- Atom type name: ProcedureNode
-- Atom type name: GroundedProcedureNode
-- Atom type name: SchemaNode
-- Atom type name: GroundedSchemaNode
-- Atom type name: PredicateNode
-- Atom type name: GroundedPredicateNode
-- Atom type name: DefinedRelationshipNode
-- Atom type name: SchemaExecutionLink
-- Atom type name: SchemaEvaluationLink
-- Atom type name: AnchorNode
-- Atom type name: QuantityLink
-- Atom type name: VirtualLink
-- Atom type name: GreaterThanLink
-- Atom type name: EqualLink
-- Atom type name: FunctionLink
-- Atom type name: ExecutionOutputLink
-- Atom type name: FoldLink
-- Atom type name: ArithmeticLink
-- Atom type name: PlusLink
-- Atom type name: TimesLink
-- Atom type name: DeleteLink
-- Atom type name: AssignLink
-- Atom type name: InsertLink
-- Atom type name: RemoveLink
[ 6%] Built target opencog_atom_types
[ 6%] Building CXX object opencog/atomutils/CMakeFiles/atomutils.dir/AtomUtils.cc.o
Scanning dependencies of target logger_cython
[ 6%] Building CXX object opencog/cython/opencog/CMakeFiles/logger_cython.dir/logger.cpp.o
/home/admin2/Documents/atomspace/opencog/cython/PythonEval.cc:39:35: fatal error: opencog/atomspace_api.h: No such file or directory
#include "opencog/atomspace_api.h"
^
compilation terminated.
[ 9%] Building CXX object opencog/atoms/core/CMakeFiles/atomcore.dir/FreeLink.cc.o
Linking CXX shared library logger.so
[ 9%] Built target logger_cython
[ 11%] Building CXX object opencog/atomspaceutils/CMakeFiles/atomspaceutils.dir/AtomSpaceUtils.cc.o
[ 11%] Building CXX object opencog/atoms/core/CMakeFiles/atomcore.dir/PutLink.cc.o
Linking CXX shared library libatomutils.so
[ 11%] Built target atomutils
opencog/cython/CMakeFiles/PythonEval.dir/build.make:54: recipe for target 'opencog/cython/CMakeFiles/PythonEval.dir/PythonEval.cc.o' failed
make[2]: *** [opencog/cython/CMakeFiles/PythonEval.dir/PythonEval.cc.o] Error 1
CMakeFiles/Makefile2:1354: recipe for target 'opencog/cython/CMakeFiles/PythonEval.dir/all' failed
make[1]: *** [opencog/cython/CMakeFiles/PythonEval.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX shared library libatomspaceutils.so
[ 11%] Built target atomspaceutils
Linking CXX shared library libatomcore.so
[ 11%] Built target atomcore
Linking CXX shared library libjson_spirit.so
[ 11%] Built target json_spirit
Makefile:133: recipe for target 'all' failed
make: *** [all] Error 2

Any help would be appreciated!

Thanks.

Bug or feature? deleting an atom using a variable in scm shell does remove the atom from the atomspace but not from the scheme enviroment.

1. Inpute atoms

opencog> (clear)
Entering scheme shell; use ^D or a single . on a line by itself to exit.
guile> 
guile> (cog-prt-atomspace)

guile> (define x (cog-new-node 'ConceptNode "abc")) 

guile> (cog-prt-atomspace)
(ConceptNode "abc")

guile> (define y (cog-new-node 'ConceptNode "def")) 

guile> (cog-prt-atomspace)
(ConceptNode "def")
(ConceptNode "abc")

guile> (define l (cog-new-link 'ListLink x y)) 

guile> (cog-prt-atomspace)
(ListLink
   (ConceptNode "abc")
   (ConceptNode "def")
)

2. delete the link

guile> (cog-delete l)
#t
guile> (cog-prt-atomspace)
(ConceptNode "def")
(ConceptNode "abc")

3. part that caused me to doubt what the scheme shell does,

@williampma informed me that the following was always the case.

guile> l
(ListLink
   (ConceptNode "abc")
   (ConceptNode "def")
)

guile> (cog-prt-atomspace)
(ConceptNode "def")
(ConceptNode "abc")

guile> (cog-handle l)
59
guile> (cog-outgoing-set l)
((ConceptNode "abc")
 (ConceptNode "def")
)
guile> (cog-atom (cog-handle l))
#<Invalid handle>

guile> (SetLink l)
(SetLink (av 0 0 0)
   (ListLink
      (ConceptNode "abc")
      (ConceptNode "def")
   )
)

guile> (cog-prt-atomspace)
(SetLink (av 0 0 0)
   (ListLink
      (ConceptNode "abc")
      (ConceptNode "def")
   )
)

My assumption (used to think that I knew, thus this issue) was that on evaluating the varaible l , after deleting the atom, the print out on the shell was a confirmation that the atom has been reinserted into the atomspace, which is not the case. So, is this a bug or a feature? @linas

"Expecting GroundedPredicateNode!" error

Empty atomspace, add the following

(EvaluationLink (stv 1.000000 0.000000)
  (PredicateNode "sell") ; [8621]
  (ListLink (stv 1.000000 0.000000)
    (VariableNode "$x") ; [8615]
    (VariableNode "$y") ; [8618]
    (VariableNode "$z") ; [8622]
  ) ; [8623]
) ; [8624]

Then do

(cog-satisfy (VariableNode "$B"))

gives me

Backtrace:
In ice-9/boot-9.scm:
 157: 10 [catch #t #<catch-closure 3ec3120> ...]
In unknown file:
   ?: 9 [apply-smob/1 #<catch-closure 3ec3120>]
In ice-9/boot-9.scm:
 157: 8 [catch #t #<catch-closure 38a2fe0> ...]
In unknown file:
   ?: 7 [apply-smob/1 #<catch-closure 38a2fe0>]
   ?: 6 [call-with-input-string "(cog-satisfy (VariableNode \"$B\"))\n" ...]
In ice-9/boot-9.scm:
2320: 5 [save-module-excursion #<procedure 3847600 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
  44: 4 [read-and-eval #<input: string 381c5b0> #:lang ...]
  37: 3 [lp (cog-satisfy (VariableNode "$B"))]
In unknown file:
   ?: 2 [opencog-extension cog-satisfy ((VariableNode "$B")
)]
In ice-9/boot-9.scm:
 102: 1 [#<procedure 38a3940 at ice-9/boot-9.scm:97:6 (thrown-k . args)> C++-EXCEPTION ...]
In unknown file:
   ?: 0 [apply-smob/1 #<catch-closure 38a2fa0> C++-EXCEPTION ...]

ERROR: In procedure apply-smob/1:
ERROR: In procedure cog-satisfy: Expecting GroundedPredicateNode! (/home/william/atomspace/opencog/atoms/execution/EvaluationLink.cc:177)
ABORT: C++-EXCEPTION

Why is that?

Pattern matcher branch exploration problem

There is a bug in pattern matcher for queries having common atoms shared by different sub-patterns (sub-tree branches). See example:

(define (SharedAtom)
        (AndLink
                (ConceptNode "A")
        )
)

(define (Tree)
        (ListLink
                (SharedAtom)
                (ListLink
                        (SharedAtom)
                        (ConceptNode "B")
                )
        )
)
(Tree)

(define (query1)
        (AndLink
                (VariableNode "$a")
        )
)

(define (query2)
        (VariableNode "$a")
)

(define (tree-query input-query)
        (BindLink
                (VariableList
                        (VariableNode "$a")
                        (VariableNode "$b")
                )
                (AndLink
                        (ListLink
                                (input-query)
                                (ListLink
                                        (input-query)
                                        (VariableNode "$b")
                                )
                        )
                )
                (ListLink
                        (VariableNode "$a")
                        (VariableNode "$b")
                )
        )
)

(cog-bind (tree-query query1))
(cog-bind (tree-query query2))

The answer is:

$2 = (SetLink
   (ListLink
      (ConceptNode "A")
      (ConceptNode "B")
   )
   (ListLink
      (ConceptNode "A")
      (ConceptNode "B")
   )
)

$3 = (SetLink
   (ListLink
      (AndLink
         (ConceptNode "A")
      )
      (ConceptNode "B")
   )
)

The answer for query1 is duplicated. The right size of satisfying set is 1 for both queries. This is simple example but this may bring weird problems for more complicated settings.

I have checked that it happens when there exists an atom shared by sub-patterns and moreover the main pattern is explored recursively bottom-up. Then all branches are explored.
The difference between this two queries is because the pattern matcher uses "choose thinnest term strategy" and finds as starters different terms.
For query1 the starter is a bottom atom:

Start term is: (AndLink (stv 1,000000 0,000000)
  (VariableNode "$a") ; [7]
) ; [10]

For query2 the starter is a top atom:

Start term is: (ListLink (stv 1,000000 0,000000)
  (VariableNode "$a") ; [7]
  (ListLink (stv 1,000000 0,000000)
    (VariableNode "$a") ; [7]
    (VariableNode "$b") ; [8]
  ) ; [14]
) ; [19]

It seems that the shared pattern should be explored only in one location and this is a fix. I am not sure yet.

Add support for optional arguments in define_scheme_primitive

I tried overloading a scheme definition with multiple define_scheme_primitive on the same scheme function name, see ngeiswei@ee6995c

When calling cog-fc with a single argument it works, but when calling with 2 it tells me that the number of arguments is wrong.

I'd like to upgrade define_scheme_primitive to somehow support optional arguments, but before I start doing that I'll like to know if that's a good idea, maybe there's already an available workaround I am not aware of. Thanks.

use __path__ to locate additional python locations!

add the/usr/local/share/opencog/python system directory to the __path__ in the __init__.py's of the "opencog" build packages.

This page looks helpful:
http://stackoverflow.com/questions/2699287/what-is-path-useful-for

I'm guessing that the source/build dir should use __path__ to say "hey if you did not find it here, then look at the install location, but let the source/build always have priority over install" 

By contrast, the installed __init__ should NOT use __path__ since the install location should be "unique" from its own point of view ...

unbound variable on cog-execute! from the cogserver

Trying to run #57

Backtrace:
In ice-9/boot-9.scm:
 157: 12 [catch #t #<catch-closure 3339bc0> ...]
In unknown file:
   ?: 11 [apply-smob/1 #<catch-closure 3339bc0>]
In ice-9/boot-9.scm:
 157: 10 [catch #t #<catch-closure 33398e0> ...]
In unknown file:
   ?: 9 [apply-smob/1 #<catch-closure 33398e0>]
   ?: 8 [call-with-input-string "(counter) (counter)(counter)(counter)\n" ...]
In ice-9/boot-9.scm:
2320: 7 [save-module-excursion #<procedure 3119510 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
  44: 6 [read-and-eval #<input: string 1be8dd0> #:lang ...]
  37: 5 [lp (counter)]
In ice-9/eval.scm:
 386: 4 [eval # #]
 393: 3 [eval # #]
In unknown file:
   ?: 2 [memoize-variable-access! #<memoized cog-execute!> #<directory # 18aac60>]
In ice-9/boot-9.scm:
 102: 1 [#<procedure 3118780 at ice-9/boot-9.scm:97:6 (thrown-k . args)> unbound-variable ...]
In unknown file:
   ?: 0 [apply-smob/1 #<catch-closure 3339860> unbound-variable ...]

ERROR: In procedure apply-smob/1:
ERROR: Unbound variable: cog-execute!
ABORT: unbound-variable

on the cogserver. .guile has the following

; OpenCog paths
(add-to-load-path "/opencog")
(add-to-load-path "/opencog/build")
(add-to-load-path "/opencog/opencog/scm")
(add-to-load-path) "/usr/local/share/opencog")
(add-to-load-path "/usr/local/share/opencog/scm")
(add-to-load-path ".")

; Enable readline features for the REPL
(use-modules (ice-9 readline))
(activate-readline)

It used to work without the following lines in .guile

(add-to-load-path "/usr/local/share/opencog")
(add-to-load-path "/usr/local/share/opencog/scm")

what am i missing?

PMCB's node_match pathing question

Anyone know why didn't this pattern in the test match to anything?

https://github.com/opencog/atomspace/blob/8112ab7731bea56a635d402bac80d46ebea5b94c/tests/query/MissingUTest.cxxtest

I overwrote node_match to allow any node to match to VariableNode, so this should results in (ConceptNode "John") being matched to (VariableNode "$Z"), but the Pattern Matcher didn't even go into the node_match callback and produced no grounding.

It only does this in some cases. For example, with the current bc-example.scm (https://github.com/opencog/atomspace/blob/master/tests/rule-engine/bc-example.scm) searching

(ImplicationLink
 (VariableNode "$A")
 (InheritanceLink
  (ConceptNode "Fritz")
  (ConceptNode "green")
  )
)

can match (ConceptNode "Fritz") to (VariableNode "$Z"). However, as soon as I changed to search for a non-existence name

(ImplicationLink
 (VariableNode "$A")
 (InheritanceLink
  (ConceptNode "RandomName")
  (ConceptNode "green")
  )
)

it fails to match to (VariableNode "$Z"). Not sure if there's something I am not seeing with the pattern. Maybe some path exploration problem that only happens on some rare instances when a node is to be matched to another node that is already wrapped by another VariableNode?

Remove ImplicationLink from PM BindLink

Overview

I think we can make BindLink take 3 arguments (or 2 when no variable restrictions) and remove the ImplicationLink without hurting anything.

Specification

Instead of

BindLink
   <Variables> (optional)
   ImplicationLink
      <Clauses>
      <Rewrite>

we would have

BindLink
   <Variables> (optional)
   <Clauses>
   <Rewrite>

Example

For example, instead of

BindLink
   VariableNode X
   ImplicationLink
      InheritanceLink
         VariableNode X
         ConceptNode "Earth"
      VariableNode X

we would have

BindLink
   VariableNode X
   InheritanceLink
      VariableNode X
      ConceptNode "Earth"
   VariableNode X

(which would return a SetLink of all things that inherit "earth").

It is simpler, why not go for it?

Motivation

  1. The PM is such a fundamental part of the AtomSpace, it has to be as perfect as possible, people are gonna use this zillions of times, we cannot afford any cruft on it.
  2. No more interferences with PLN rules.

Yours

If you guys approve I'm happy to take care of it.

(use-modules (opencog)) doesn't seem to load scheme files

According to opencog/scm/opencog.scm scheme files like utilities.scm should be automatically loaded but aren't.

I've added a bunch of (display "~~~ N ~~~:") in opencog/scm/opencog.scm to see whether those loading lines are executed, they seem to be. I'm really puzzled, see below:

nilg@laptop:~/OpenCog/opencog/opencog/reasoning/pln$ guile --no-auto-compile
;;; note: source file /usr/local/share/opencog/scm/opencog.scm
;;;       newer than compiled /home/nilg/.cache/guile/ccache/2.0-LE-8-2.0/usr/local/share/opencog/scm/opencog.scm.go
~~~ 1 ~~~:~~~ 2 ~~~:~~~ 3 ~~~:~~~ 4 ~~~:~~~ 5 ~~~:GNU Guile 2.0.9
Copyright (C) 1995-2013 Free Software Foundation, Inc.

Guile comes with ABSOLUTELY NO WARRANTY; for details type `,show w'.
This program is free software, and you are welcome to redistribute it
under certain conditions; type `,show c' for details.

Enter `,help' for help.
scheme@(guile-user)> (use-modules (opencog))
scheme@(guile-user)> (stv 1 1)
;;; <stdin>:2:0: warning: possibly unbound variable `stv'
<unnamed port>:2:0: In procedure #<procedure 1ba5020 at <current input>:2:0 ()>:
<unnamed port>:2:0: In procedure module-lookup: Unbound variable: stv

Entering a new prompt.  Type `,bt' for a backtrace or `,q' to continue.
scheme@(guile-user) [1]> (load-from-path "utilities.scm")
scheme@(guile-user) [1]> (stv 1 1)
$1 = (stv 1 0.99999982)

As you can see (stv 1 1) only runs after re-loading utilities.scm. Obviously (using-modules (opencog)) is present in my .guile config file. Running out of idea, any advice is welcome, thanks!

Bug with deleting atom spanning multiple atomspace

Not sure whether to put this in "atomspace" or "opencog".

Have a module that does the following, which get called in cogserver's scheme shell

    AtomSpace* temp = new AtomSpace(_as);   // temp has _as parent

    Handle h1 = _as->addAtom(createNode(CONCEPT_NODE, "aaa"));
    Handle h2 = temp->addAtom(createNode(CONCEPT_NODE, "bbb"));
    temp->addAtom(createLink(LIST_LINK, h1, h2));

    delete temp;
    return;

then do cog-prt-atomspace, cogserver crashes.

Any need to keep these protobuf message types?

What is the purpose of these messages? Is there any reason for keeping this message types?

  1. https://github.com/opencog/atomspace/blob/master/opencog/persist/zmq/atomspace/ZMQMessages.proto#L43 . Last commit refering to Trail is c9bacab . Trail seems to have been a continaer for storing a series of atoms, could have been used similarly to inference history in the python-pln
  2. https://github.com/opencog/atomspace/blob/master/opencog/persist/zmq/atomspace/ZMQMessages.proto#L20 . Last commit refering to VersionHandle is 518f603

This follows from @ceefour's suggestion @ https://groups.google.com/d/msg/opencog/KUrO5fx0bKg/uilwdioF9nYJ for the neo4j backing store.

@cosmoharrigan @linas @ngeiswei

Evaluatable in non-logical link inside BindLink clause

Just thought I would throw this out there. Doing cog-bind on the following craziness

(BindLink
    (VariableList (stv 1.000000 0.000000)
        (VariableNode "$A") ; [80]
        (VariableNode "$B") ; [92]
        (VariableNode "$C") ; [103]
    )
    (MemberLink (stv 1.000000 1.000000)
        (BindLink (stv 1.000000 0.000000)
            (VariableList (stv 1.000000 0.000000)
                (TypedVariableLink (stv 1.000000 0.000000)
                    (VariableNode "$A") ; [80]
                    (TypeNode "ConceptNode") ; [100]
                ) ; [101]
                (TypedVariableLink (stv 1.000000 0.000000)
                    (VariableNode "$B") ; [92]
                    (TypeNode "ConceptNode") ; [100]
                ) ; [102]
                (TypedVariableLink (stv 1.000000 0.000000)
                    (VariableNode "$C") ; [103]
                    (TypeNode "ConceptNode") ; [100]
                ) ; [104]
            ) ; [105]
            (AndLink (stv 1.000000 0.000000)
                (InheritanceLink (stv 1.000000 0.000000)
                    (VariableNode "$A") ; [80]
                    (VariableNode "$B") ; [92]
                ) ; [106]
                (InheritanceLink (stv 1.000000 0.000000)
                    (VariableNode "$B") ; [92]
                    (VariableNode "$C") ; [103]
                ) ; [107]
                (NotLink (stv 1.000000 0.000000)
                    (EqualLink (stv 1.000000 0.000000)
                        (VariableNode "$A") ; [80]
                        (VariableNode "$C") ; [103]
                    ) ; [108]
                ) ; [109]
            ) ; [110]
            (ExecutionOutputLink (stv 1.000000 0.000000)
                (GroundedSchemaNode "scm: pln-formula-simple-deduction") ; [111]
                (ListLink (stv 1.000000 0.000000)
                    (InheritanceLink (stv 1.000000 0.000000)
                        (VariableNode "$A") ; [80]
                        (VariableNode "$B") ; [92]
                    ) ; [106]
                    (InheritanceLink (stv 1.000000 0.000000)
                        (VariableNode "$B") ; [92]
                        (VariableNode "$C") ; [103]
                    ) ; [107]
                    (InheritanceLink (stv 1.000000 0.000000)
                        (VariableNode "$A") ; [80]
                        (VariableNode "$C") ; [103]
                    ) ; [112]
                ) ; [113]
            ) ; [114]
        ) ; [115]
        (ConceptNode "URE") ; [116]
    ) ; [118]
    (ListLink
        (VariableNode "$A") ; [80]
        (VariableNode "$B") ; [92]
        (VariableNode "$C") ; [103]
    )
)

gives me

ERROR: In procedure cog-bind: Unknown logical connective (MemberLink (stv 1.000000 1.000000)
...

I stumbled upon this when the BC algorithm tried to backward chain an untyped (VariableNode "$stuff") target (from modus ponens rule), which match to everything in the atomspace. Then since the variables inside the interior MemberLink are by current algorithmic definition "free", the MemberLink is added as a target as a "Variable Fullfillment Query", and then generate the above error when trying to ground it.

DefineLink full support

We're getting close to being able to use Atomese as a real programming language. It seems we still need to add (full) support for DefineLink.

I think the following wiki page

http://wiki.opencog.org/w/Definelink#SchemaNode

correctly defines what we want.

Do we agree on that?

Or do you think PutLink/GetLink can be substituted to DefineLink?

Derived AtomSpace's getHandlesByType() bug?

Some inconsistency while working with InitiateSearchCB::link_type_search() lead me to this problem:

Empty AtomSpace _as:

    AtomSpace temp(_as);

    _as->addNode(CONCEPT_NODE, "lalala");
    temp.addNode(CONCEPT_NODE, "kakaka");

    HandleSeq handle_set;
    temp.getHandlesByType(handle_set, CONCEPT_NODE);

I expected handle_set will be size 2, but instead got size 1. Only "kakaka" was found, even though "lalala" should also be considered part of "temp"?

Build fail: /bin/sh: 1: cabal: not found

william@william-VirtualBox:~/atomspace/build$ make
[  2%] Built target json_spirit
[  2%] Built target opencog_atom_types
[  4%] Built target atomutils
[  6%] Built target atomcore
[ 13%] Built target lambda
[ 20%] Built target clearbox
[ 46%] Built target atomspace
[ 46%] Built target atomspaceutils
[ 48%] Built target atomspace_cython
[ 51%] Built target PythonEval
[ 60%] Built target smob
[ 69%] Built target query
[ 72%] Built target execution
[ 81%] Built target ruleengine
[ 81%] Built target atomspace_bm
[ 81%] Built target persist
[ 83%] Built target persist-sql
[ 83%] Built target sniff
[ 86%] Built target bindlink_cython
[ 88%] Built target logger_cython
[ 93%] Built target scheme_wrapper
[ 93%] Built target type_constructors
[ 97%] Built target utilities_cython
[100%] Built target haskell-atomspace
[100%] Installing: opencog-atomspace haskell library...
/bin/sh: 1: cabal: not found
make[2]: *** [opencog/haskell/dist] Error 127
make[1]: *** [opencog/haskell/CMakeFiles/haskell-atomspace-lib.dir/all] Error 2
make: *** [all] Error 2

Do I need to install cabal?

Constify the AtomSpace API

Proposal

I think the AtomSpace API can be properly constified. I had tried many months ago but this time I got a bit further. I think this is sufficiently important to get some attention. Ultimately it might help to avoid some bugs.

For instance

const Handle h;

would not allow to modify the atom attributes referred by h.

Or perhaps one may want to define a ConstHandle type (like const_iterator in STL). I personally don't think it would be necessary. I don't think we care in practice to have the freedom of modifying a Handle while not having the freedom of modifying its constant. So a mere const Handle, meaning

  1. Can't change Handle
  2. Can't change Atom

would do.

Failed attempt

I tried but failed, thought I think it's possible. The mutex _mtx needs to be mutable. And one needs to use for the const accessors AtomConstPtr, NodeConstPtr, LinkConstPtr, etc beside AtomPtr, etc.

Any remarks?

I would like to hear about your remarks before I try again.

cog-delete-recursive documentation isn't correct

cog-delete-recursive's documentation isn't exactly correct here

       ; Verify that the link l is gone:
       guile> l
       Invalid handle

       ; Verify that the node x is gone:
       guile> x
       Invalid handle

in reality it shows the atoms referenced by l and x

scheme@(guile-user)> l
$8 = (Link
   (ConceptNode "abc")
   (ConceptNode "def")
)

scheme@(guile-user)> x
$9 = (ConceptNode "abc")

However the behavior of cog-delete-recursive is correct, using prt-atomspace as given in http://wiki.opencog.org/w/Scheme#Print_all_atoms_in_the_AtomSpace (EDIT: you can use directly cog-prt-atomspace) I can see that the atoms corresponding to l and x are indeed missing.

I'm not sure whether the documentation should be fixed or what is returned by l and x should be fixed.

Functional type system for hypegraphs

Object

Proposal for an hypergraph type checker.

Motivation

The current type system is too limiting and doesn't allow to overload
operators. Here's an example when using PLN Or/And rules.

For instance, one might want to write

OrLink
    ConceptNode "Big"
    AndLink
        ConceptNode "Tall"
        ConceptNode "Slim"

But we need to tell that OrLink arguments are ConceptNode or AndLink,
however an AndLink may not necessarily have the right type, for
instance the following is ill-formed:

OrLink
    ConceptNode "Big"
    AndLink
        PredicateNode "is_tall"
        PredicateNode "is_slim"

So is the following:

OrLink
    ConceptNode "Big"
    AndLink
        EvaluationLink
            PredicateNode "is_tall"
            ConceptNode "John"
        EvaluationLink
            PredicateNode "is_slim"
            ConceptNode "Cathy"

Maybe one can address that by creating several OrLink types, like
OrConceptLink, OrPredicateLink, OrFuzzyTVLink. Or alternatively use
SatifyingSet implicitly, etc. However even if that would not solve the
problem generally, as in the cases involving Schemas, etc. We need a
real type system to handle those cases.

Proposal

I suggest a type system kinda on top of the current atom type system
as defined in atom_types.script. Let's call it the "functional type
system" or the FT system for short. Let me jump straight into the
definitions, then I'll give a few examples.

Terminology

I'm using Haskell terminology as much as possible, so

E :: T

is used to denote the type T of expression (or hypergraph) E.

T1 -> T2

denotes the type of a function with domain T1 and co-domain T2.

T1 -> T2 -> T3

similarly denotes a function that take 2 arguments of types T1 and
T2, and return type T3.

P => T

denotes the precondition P of type T.

T1 == T2

means that T1 is exactly equal to T2.

T1 <= T2

means T1 inherits T2 (this one doesn't exist in Haskell I think).

Simple primitive functional types (non exhaustive list)

Primitive types start in upper case, while type variables start in
lower case.

ATOM :: Atom
CONCEPT_NODE :: Concept
NUMBER_NODE :: Number
VARIABLE_NODE :: Variable

You may notice the absence of Node in the type name, that is because
that notion is now represented with the type signature itself. We'll
see that with type functions such as lists.

Of course all types above inherit from Atom, that is

Concept <= Atom, Number <= Atom, etc.

Finally we've got the type

TV

which denotes a truth value. By truth value I mean its most general
form, a pdf over [0, 1], I don't make the distinction between
probabilistic and fuzzy truth value, because it turns out the type
system can be used for that, and besides, the real nature of a truth
value is both fuzzy and probabilistic, depending on the way the PLN
rules are gonna use them.

Composite functional types (non exhaustive list)

LIST_LINK :: [a]

[a] is in fact syntactic sugar for List a

MEMBER_LINK :: Atom -> Concept -> TV

so this means that MEMBER_LINK takes an atom, a concept and returns a
TV.

PREDICATE_NODE :: [Atom] -> TV

Let's also define a type for it since it is used a lot

Predicate == [Atom] -> TV
EVALUATION_LINK :: Predicate -> [Atom] -> TV
IMPLICATION_LINK :: Predicate -> Predicate -> TV
EQUIVALENCE_LINK :: Predicate -> Predicate -> TV
INHERITANCE_LINK :: Concept -> Concept -> TV
SIMILARITY_LINK :: Concept -> Concept -> TV
AND_LINK :: a <= Concept or a <= Predicate or a == TV => a -> a -> a
OR_LINK :: a <= Concept or a <= Predicate or a == TV => a -> a -> a
NOT_LINK :: a <= Concept or a <= Predicate or a == TV => a -> a
BindLink :: [Variable] -> Atom -> Predicate
ForAllLink :: [Variable] -> Atom -> TV

As you may see BindLink and ForAllLink have different type signatures,
BindLink is used to define a predicate, while ForAllLink defines a
TV.

SchemaNode :: [Atom] -> Atom

Or more precisely

SchemaNode "+" :: [Number] -> Number

You may notice that I use [Atom] as argument of PredicateNode, that's
because I noticed that all over the code a PredicateNode has always a
ListLink. For instance a 0-ary predicate is only defined over an empty
list. I don't know if that's necessarily a good idea, but as it's seem
expressive enough, I chose to have my notations as alligned as
possible with the existing use.

Tuple

It seems useful to have something finer than List, to be able to
express the number of elements and their types, for that we introduce
N-Tuple that inherit lists.

ListLink
    NumberNode "3"
    NumberNode "2"
:: [Atom]
:: [Number]
:: 2-Tuple Number Number

with of course

(2-Tuple Number Number) <= [Number] <= [Atom]

That way we can express things like

SchemaNode "/" :: (2-Tuple Number Number) -> Number

Examples

Now let's show the type of some hypergraphs:

Apply a predicate

EvaluationLink <tv>
    PredicateNode "P"
    ListLink
        ConceptNode "A"
        ConceptNode "B"
:: TV

Build a predicate

BindLink
    ListLink
        VariableNode "$X"
    AndLink
        EvaluationLink
            PredicateNode "Tall"
            ListLink
                VariableNode "$X"
        EvaluationnLink
            PredicateNode "Slim"
            ListLink
                VariableNode "$X"
:: Predicate

Apply a schema

ExecutionOutputLink
    SchemaNode "+"
        ListLink
            NumberNode "3"
            NumberNode "2"
:: Number

Further remarks

Extensional, intensional and mixed

Following the type system we can type check mixed
relationships. For instance we know that

InheritanceLink
    A
    B
:: TV

is equivalent to

OrLink
    ExtensionalInheritanceLink
        A
        B
    IntentionalInheritanceLink
        A
        B
:: TV

assumming that both ExtensionalInheritanceLink and
IntentionalInheritanceLink return TV, then we can use the OrLink type

OrLink :: a <= Concept or a <= Predicate or a == TV => a -> a -> a

with a == TV, to obviously type check mixed inheritance.

IO monad

Could we represent procedure's side effects with IO monad? For
instance

PredicateNode "is_pixel_blue" :: (2-tuple Number Number) -> IO TV

(do-em-all) throws a C++ exception after loading around 50,000-60,000 atoms

I am gathering statistics on a parse server that Linas has set up for gathering data related to the language learning project. I ran (do-em-all) after I gathered some substantial amount of word pairs, so that the MI could be computed and further processing could begin. This was the error/exception that I was getting:

Backtrace:
In ice-9/boot-9.scm:
157: 12 [catch #t #<catch-closure 40bb4bc0> ...]
In unknown file:
?: 11 [apply-smob/1 #<catch-closure 40bb4bc0>]
In ice-9/boot-9.scm:
157: 10 [catch #t #<catch-closure 40bb4a80> ...]
In unknown file:
?: 9 [apply-smob/1 #<catch-closure 40bb4a80>]
?: 8 [call-with-input-string "(do-em-all)\n" ...]
In ice-9/boot-9.scm:
2320: 7 [save-module-excursion #<procedure 40b5f7b0 at ice-9/eval-string.scm:65:9 ()>]
In ice-9/eval-string.scm:
44: 6 [read-and-eval #<input: string 4184a270> #:lang ...]
37: 5 [lp (do-em-all)]
In /home/rohit/../..//home/opencog/src/opencog/opencog/nlp/learn/compute-mi.scm:
1018: 4 [batch-all-pair-mi (LinkGrammarRelationshipNode "ANY" (ctv 1 0 22408396))
]
717: 3 [batch-all-pair-wildcard-counts #]
In unknown file:
?: 2 [opencog-extension fetch-incoming-set (#)]
In ice-9/boot-9.scm:
102: 1 [#<procedure 3e597a00 at ice-9/boot-9.scm:97:6 (thrown-k . args)> C++-EXCEPTION ...]
In unknown file:
?: 0 [apply-smob/1 #<catch-closure 40bb4a40> C++-EXCEPTION ...]

ERROR: In procedure apply-smob/1:
ERROR: In procedure fetch-incoming-set: Unexpected handle mismatch! Expected 15981 got 1792030
(/home/opencog/src/atomspace/opencog/atomspace/AtomSpace.cc:303)
ABORT: C++-EXCEPTION

BindLink clause with a single evaluatable

Come across this while marking a single (VariableNode $A) clause as "evaluatable" (since if it maps to an "evaluatable", special treatment is need to evaluate the mapped stuff)

guile> (define B 
   (BindLink 
      (VariableList (VariableNode "$A") (VariableNode "$B")) 
      (EqualLink (VariableNode "$A") (VariableNode "$B"))
      (ListLink (VariableNode "$A") (VariableNode "$B"))))

guile> (cog-bind B)
(SetLink
)

ie. a BindLink with a single virtual clause currently is not run and not grounded. Should it? The above query should produce every single atom in the AtomSpace right?

fail to compile BasicSaveUTest

[ 51%] Building CXX object tests/persist/sql/CMakeFiles/BasicSaveUTest.dir/BasicSaveUTest.cpp.o
In file included from /atomspace/build/tests/persist/sql/BasicSaveUTest.cpp:24:0:
/atomspace/tests/persist/sql/BasicSaveUTest.cxxtest:36:42: fatal error: opencog/nlp/types/atom_types.h: No such file or directory
 #include <opencog/nlp/types/atom_types.h>
                                          ^
compilation terminated.
make[3]: *** [tests/persist/sql/CMakeFiles/BasicSaveUTest.dir/BasicSaveUTest.cpp.o] Error 1
make[2]: *** [tests/persist/sql/CMakeFiles/BasicSaveUTest.dir/all] Error 2
make[1]: *** [CMakeFiles/tests.dir/rule] Error 2
make: *** [tests] Error 2

I think this has to be moved to opencog, and add scheme binding test in its place, right ? @linas

Haskell build break.

Something about the haskell bindings breaks the build. I get

cabal: Could not resolve dependencies:
trying: opencog-atomspace-0.1.0.0

Garbage left in atomspace by executing AssignLink

@linas if I understood https://github.com/opencog/atomspace/blob/master/opencog/atoms/reduct/AssignLink.h#L70 correctly, there shouldn't be a (NumberNode "1.000000" (av 0 0 0)) in the atomspace.

guile> (clear)
guile> (define (counter)
    (define (increment-number str)  (+ (string->number str) 1))
     (let ((nn (cog-chase-link 'ReferenceLink 'NumberNode (AnchorNode "count"))) )
        (if (null? nn)
            (ReferenceLink
                (AnchorNode "count")
                (NumberNode 1)
                )
            (begin
                (cog-execute!
                    (AssignLink
                        (TypeNode "ReferenceLink")
                        (AnchorNode "count")
                        (NumberNode (increment-number (cog-name (car nn))))
                    )
                )

            )
        )
    )
)

guile> (define (ncount n)
    (while (not (= 0 n) ) (begin (set! n (- n 1)) (counter) )  )
)
guile> (ncount 5)
guile> (cog-prt-atomspace)
(ReferenceLink
   (AnchorNode "count")
   (NumberNode "5.000000" (av 0 0 0))
)
(AssignLink
   (TypeNode "ReferenceLink" (av 0 0 0))
   (AnchorNode "count")
   (NumberNode "5.000000" (av 0 0 0))
)
(AssignLink
   (TypeNode "ReferenceLink" (av 0 0 0))
   (AnchorNode "count")
   (NumberNode "4.000000" (av 0 0 0))
)
(AssignLink
   (TypeNode "ReferenceLink" (av 0 0 0))
   (AnchorNode "count")
   (NumberNode "3.000000" (av 0 0 0))
)
(AssignLink
   (TypeNode "ReferenceLink" (av 0 0 0))
   (AnchorNode "count")
   (NumberNode "2.000000" (av 0 0 0))
)
(NumberNode "1.000000" (av 0 0 0))

Exceptions thrown message turn into numbers in guile

It seems I can't get the exception message of a function in guile.

Specifically when trying to executing the example

examples/rule-engine/simple-deduction.scm

I get something like

ERROR: In procedure opencog-extension:
ERROR: Throw to key `decoding-error' with args `("scm_from_stringn" "input locale conversion error" 84 #vu8(66 97 99 107 116 114 97 99 101 58 10 73 110 32 115 121 115 116 101 109 47 118 109 47 116 114 97 112 45 115 116 97 116 101 46 115 99 109 58 10 32 49 55 50 58 32 49 57 32 91 119 105 116 104 45 100 101 102 97 117 108 116 45 116 114 97 112 45 104 97 110 100 108 101 114 32 35 102 32 46 46 46 93 10 73 110 32 105 99 101 45 57 47 98 111 111 116 45 57 46 115 99 109 58 10 49 54 52 53 58 32 49 56
...

Tracking down the problem in gdb it seems to occur when an exception is thrown.

Potential illegal memory access in Node::toString called by python binding

I found this behavior during writing unit test of my python conceptual blending project.

When I make new node with no name, AtomSpace returns wrong node with name "(".

Furthermore when I try to make new node with new AtomSpace, this problem getting worse, because it prints machine's memory contents.

This code:

from opencog.atomspace import AtomSpace
from opencog.type_constructors import *

my_as = AtomSpace()
# Make new node with **blank name**
print my_as.add_node(types.ConceptNode, "")
del my_as

my_as = AtomSpace()
print my_as.add_node(types.ConceptNode, "")
del my_as

my_as = AtomSpace()
print my_as.add_node(types.ConceptNode, "")
del my_as

...(skip)

makes this problem.

(ConceptNode "(") ; [2]

(ConceptNode " "") ; [4]

(ConceptNode "") ; [6]


...(skip)...


(ConceptNode "]
") ; [14]

(ConceptNode "") ; [16]

(ConceptNode "") ; [18]

(ConceptNode "%s "%s" (av %d %d %d) %s) ; [%lu]
") ; [20]

(ConceptNode " "%s" (av %d %d %d) %s) ; [%lu]


...(skip)...


(ConceptNode "") ; [58]

(ConceptNode "asic_string::_S_construct null not valid") ; [60]

(ConceptNode "ic_string::_S_construct null not valid") ; [62]

(ConceptNode "_string::_S_construct null not valid") ; [64]

(ConceptNode "tring::_S_construct null not valid") ; [66]

It seems problem was caused by c_str() method in Node::toString() at Node.cc:68 but I'm not sure.

My unit test makes new AtomSpace instance for each test case, and my blender has 'blank' ConceptNode to express default prefix name of new blend node.

Now I'm trying to avoid using the 'blank' ConceptNode because now I think it seems little wrong design conceptually. And the method AtomSpace::atomAsString() at AtomSpace.h:680, which was deprecated:

   /** DEPRECATED! Do NOT USE IN NEW CODE!
     * If you need this, just copy the code below into your app! */
    std::string atomAsString(Handle h, bool terse = true) const {
        if (terse) return h->toShortString();
        return h->toString();
    }

makes this problem because it calls toString() method. But since python users use this method very often because python binding of Atom uses it in __str__, so I think I have to report this problem to community.

GetLink usage

Scenario 1

Defined

(define (counter)
    (define (increment-number str)  (+ (string->number str) 1))
    (let ((nn (cog-chase-link 'ReferenceLink 'NumberNode (AnchorNode "count"))) )

        (if (null? nn)
            (ReferenceLink
                (AnchorNode "count")
                (NumberNode 1)
                )
            (cog-execute! (cog-execute!
                (AssignLink
                    (TypeNode "AssignLink")
                    (TypeNode "ReferenceLink")
                    (AnchorNode "count")
                    (NumberNode (increment-number (cog-name (car nn))))
                )
            ))

        )
    )
)

(define get
    (GetLink
        (AssignLink
            (TypeNode "AssignLink")
            (TypeNode "ReferenceLink")
            (AnchorNode "count")
            (VariableNode "x")
        )
    )
)

Run on the cogserver

guile> (counter) (counter)(counter)(counter) ; run as many time as you like
guile> (cog-satisfying-set get)
(SetLink
)

Senario 2:

load AssignLinks from https://github.com/opencog/atomspace/blob/master/examples/guile/assign.scm#L61

Defined

(define get2
    (GetLink 
        (AssignLink
        (TypeNode "EvaluationLink")
        (PredicateNode "some property")
        (ListLink
            (ConceptNode "thing A")
            (VariableNode "x")))))

Run on the cogserver

guile> (cog-satisfying-set get2)
(SetLink
   (ConceptNode "alternative B")
   (ConceptNode "The V alternative")
)

@linas why doesn't Scenario 1 work? Is it a feature or a bug?

"SatisfactionLink with no VariableNode" crashes

I assume SatisfactionLink is still a thing (kind of lost track with the recent changes).

I tried doing this weird call

(cog-satisfy (SatisfactionLink (ConceptNode "ABC")))

and cogserver crashed with

[2015-06-02 03:52:50:762] [ERROR] Caught signal 11 (Segmentation fault) on thread 140036640466688
    Stack Trace:
    2: basic_string.h:539   ~basic_string()
    3: CogServerMain.cc:79  _Z7sighandi()
    4: ??:0 killpg()
    5: PatternMatchEngine.cc:948      opencog::PatternMatchEngine::explore_link_branches(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&)
    6: InitiateSearchCB.cc:286    opencog::InitiateSearchCB::neighbor_search(opencog::PatternMatchEngine*)
    7: InitiateSearchCB.cc:481    opencog::InitiateSearchCB::disjunct_search(opencog::PatternMatchEngine*)
    8: PatternMatch.cc:341    opencog::PatternLink::satisfy(opencog::PatternMatchCallback&) const
    9: shared_ptr_base.h:779    __shared_ptr()
    10: SchemeModule.cc:41    opencog::FunctionWrap::prapper(opencog::Handle)
    11: shared_ptr_base.h:545   ~__shared_count()
    12: SchemePrimitive.cc:158    opencog::PrimitiveEnviron::do_call(scm_unused_struct*, scm_unused_struct*)
    13: ??:0    scm_vm_engine()
    14: ??:0    scm_call_1()
    15: ??:0    scm_vm_engine()
    16: ??:0    scm_call_3()
    17: ??:0    scm_vm_engine()
    18: ??:0    scm_call_4()
    19: SchemeEval.cc:606     opencog::SchemeEval::do_eval(std::string const&)
    20: SchemeEval.cc:535     opencog::SchemeEval::c_wrap_eval(void*)
    21: ??:0    scm_at_abort()
    22: ??:0    scm_vm_engine()
    23: ??:0    scm_call_4()
    24: ??:0    scm_at_abort()
    25: ??:0    scm_c_with_continuation_barrier()
    26: ??:0    GC_call_with_gc_active()
    27: ??:0    scm_current_processor_count()
    28: ??:0    GC_call_with_stack_base()
    29: ??:0    scm_with_guile()
    30: SchemeEval.cc:502     opencog::SchemeEval::eval_expr(std::string const&)
    31: basic_string.h:293    std::string::_M_data() const
    32: ??:0      std::this_thread::__sleep_for(std::chrono::duration<long, std::ratio<1l, 1l> >, std::chrono::duration<long, std::ratio<1l, 1000000000l> >)
    33: pthread_create.c:312    start_thread()
    34: clone.S:113 clone()

forward chaining crashes with the nlp parse for sentences

I was making scheme code to load sentences into atom space and apply r2l scheme rules on them with forward chaining but it causes a crash. below are the details.

The code is available at

https://github.com/yantrabuddhi/opencog/tree/examples/opencog/nlp/relex2logic

https://github.com/yantrabuddhi/opencog/blob/examples/opencog/nlp/scm/nlp-fc.scm

guile> (load-scm-from-file "../opencog/nlp/scm/nlp-fc.scm")
0
guile> (nlp-files-fc "/home/mandeep/cat.txt" "../opencog/nlp/relex2logic/loader/load-rules.scm")
Connection closed by foreign host.
================================
[2015-07-21 10:15:39:106] [ERROR] Caught signal 11 (Segmentation fault) on thread 140567590885120
    Stack Trace:
    2: ./opencog/server/cogserver (opencog::Logger::Base::~Base() +0x5e) [0x4080de]
    3: ./opencog/server/cogserver (sighand(int) +0xe9) [0x407719]
    4: /lib/x86_64-linux-gnu/libc.so.6 (x +0x36d40) [0x7fd885382d40]
    5: /usr/local/lib/opencog/libquery.so (opencog::PatternMatchEngine::explore_link_branches(opencog::Handle const&, opencog::Handle const&, opencog::Handle const&) +0x3b) [0x7fd876faa4ab]
    6: /usr/local/lib/opencog/libquery.so (opencog::InitiateSearchCB::neighbor_search(opencog::PatternMatchEngine*) +0x179) [0x7fd876f97cd9]
    7: /usr/local/lib/opencog/libquery.so (opencog::InitiateSearchCB::disjunct_search(opencog::PatternMatchEngine*) +0x55) [0x7fd876f9a6a5]
    8: /usr/local/lib/opencog/libquery.so (opencog::PatternLink::satisfy(opencog::PatternMatchCallback&) const +0x10e4) [0x7fd876fa16b4]
    9: /usr/local/lib/opencog/libruleengine.so (opencog::DefaultForwardChainerCB::choose_rules(opencog::FCMemory&) +0x86e) [0x7fd8739990fe]
    10: /usr/local/lib/opencog/libruleengine.so (opencog::ForwardChainer::do_step(opencog::ForwardChainerCallBack&) +0x157) [0x7fd873992e37]
    11: /usr/local/lib/opencog/libruleengine.so (opencog::ForwardChainer::do_chain(opencog::ForwardChainerCallBack&, opencog::Handle) +0x457) [0x7fd873993d87]
    12: /usr/local/lib/opencog/libruleengine.so (opencog::InferenceSCM::do_forward_chaining(opencog::Handle, opencog::Handle) +0x13d) [0x7fd8739a041d]
    13: /usr/local/lib/opencog/libruleengine.so (opencog::SchemePrimitive<opencog::InferenceSCM>::invoke(scm_unused_struct*) +0x10f5) [0x7fd8739a2145]
    14: /usr/local/lib/opencog/libsmob.so (opencog::PrimitiveEnviron::do_call(scm_unused_struct*, scm_unused_struct*) +0x24) [0x7fd884644b64]
    15: /usr/lib/libguile-2.0.so.22 (H� +0xecc00) [0x7fd8822cec00]
    16: /usr/lib/libguile-2.0.so.22 (H� +0x27) [0x7fd882246747]
    17: /usr/lib/libguile-2.0.so.22 (H� +0xecc00) [0x7fd8822cec00]
    18: /usr/lib/libguile-2.0.so.22 (H� +0x2e) [0x7fd88224681e]
    19: /usr/lib/libguile-2.0.so.22 (H� +0xecc00) [0x7fd8822cec00]
    20: /usr/lib/libguile-2.0.so.22 (H� +0x33) [0x7fd882246863]
    21: /usr/local/lib/opencog/libsmob.so (opencog::SchemeEval::do_eval(std::string const&) +0xc1) [0x7fd88463c5f1]
    22: /usr/local/lib/opencog/libsmob.so (opencog::SchemeEval::c_wrap_eval(void*) +0x33) [0x7fd88463c713]
    23: /usr/lib/libguile-2.0.so.22 (H� +0x5b2ca) [0x7fd88223d2ca]
    24: /usr/lib/libguile-2.0.so.22 (H� +0xecc00) [0x7fd8822cec00]
    25: /usr/lib/libguile-2.0.so.22 (H� +0x33) [0x7fd882246863]
    26: /usr/lib/libguile-2.0.so.22 (H� +0x5b9ff) [0x7fd88223d9ff]
    27: /usr/lib/libguile-2.0.so.22 (H� +0x35) [0x7fd88223da95]
    28: /usr/lib/x86_64-linux-gnu/libgc.so.1 (H� +0x60) [0x7fd881191950]
    29: /usr/lib/libguile-2.0.so.22 (H� +0xd47d1) [0x7fd8822b67d1]
    30: /usr/lib/x86_64-linux-gnu/libgc.so.1 (H� +0x12) [0x7fd88118bfe2]
    31: /usr/lib/libguile-2.0.so.22 (H� +0x28) [0x7fd8822b6b48]
    32: /usr/local/lib/opencog/libsmob.so (opencog::SchemeEval::eval_expr(std::string const&) +0x2e) [0x7fd88463c6be]
    33: ./opencog/shell/libscheme-shell.so (H� +0x7e94) [0x7fd876d6ee94]
    34: /usr/lib/x86_64-linux-gnu/libstdc++.so.6(+0xb1a40) [0x7fd8859d8a40]
    35: /lib/x86_64-linux-gnu/libpthread.so.0 (H� +0x8182) [0x7fd884417182]
    36: /lib/x86_64-linux-gnu/libc.so.6 (H� +0x6d) [0x7fd88544647d]

haskell errors during install

make install seems to work, but ends with a warning:

Warning: The package list for 'hackage.haskell.org' does not exist. Run 'cabal update' to download it.
cabal: Could not resolve dependencies:
trying: opencog-atomspace-0.1.0.0

the cmakefiles should not attempt to build haskell unless it is full installed.

Build errors on debian 7.8

As requested by linas:

gareth@sexy:~/atomspace/trunk/build$ make
[ 3%] Built target json_spirit
[ 4%] Built target opencog_atom_types
[ 5%] Built target atomutils
[ 17%] Built target lambda
[ 21%] Built target clearbox
[ 53%] Built target atomspace
[ 55%] Built target execution
[ 56%] Building CXX object opencog/guile/CMakeFiles/smob.dir/SchemeEval.cc.o
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:202:8: error: ‘thread_local’ does not name a type
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc: In member function ‘void opencog::SchemeEval::per_thread_init()’:
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:322:6: error: ‘thread_is_inited’ was not declared in this scope
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:323:2: error: ‘thread_is_inited’ was not declared in this scope
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc: In static member function ‘static opencog::SchemeEval* opencog::SchemeEval::get_evaluator(opencog::AtomSpace_)’:
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:1085:9: error: ‘thread_local’ does not name a type
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc: In destructor ‘opencog::SchemeEval::get_evaluator(opencog::AtomSpace_)::eval_dtor::eval_dtor()’:
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:1091:19: error: ‘issued’ was not declared in this scope
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:1091:19: error: unable to deduce ‘auto’ from ‘’
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc: In static member function ‘static opencog::SchemeEval* opencog::SchemeEval::get_evaluator(opencog::AtomSpace_)’:
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:1107:9: error: ‘thread_local’ does not name a type
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:1109:12: error: ‘issued’ was not declared in this scope
/home/gareth/atomspace/trunk/opencog/guile/SchemeEval.cc:1109:26: error: unable to deduce ‘auto’ from ‘’
make[2]: *_* [opencog/guile/CMakeFiles/smob.dir/SchemeEval.cc.o] Error 1
make[1]: *** [opencog/guile/CMakeFiles/smob.dir/all] Error 2
make: *** [all] Error 2
gareth@sexy:
/atomspace/trunk/build$ guile --version
guile (GNU Guile) 2.0.5-deb+1-3
Copyright (C) 2011 Free Software Foundation, Inc.

License LGPLv3+: GNU LGPL 3 or later http://gnu.org/licenses/lgpl.html.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
gareth@sexy:~/atomspace/trunk/build$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.7.2 (Debian 4.7.2-5)

Pattern matcher disconnected components error thrown with Abduction rule

Grounding variable "$C" in the abduction rule leads the pattern matcher to throw an error that the bindlink consists of multiple disconnected components.

Here's the grounded abduction rule bindlink (with VariableNode C replaced by ConceptNode X:)

(BindLink (av 0 0 0)
   (VariableList (av 0 0 0)
      (VariableNode "$A")
      (VariableNode "$B")
   )
   (ImplicationLink
      (AndLink
         (InheritanceLink
            (VariableNode "$A")
            (ConceptNode "X")
         )
         (InheritanceLink
            (VariableNode "$B")
            (ConceptNode "X")
         )
      )
      (ExecutionOutputLink
         (GroundedSchemaNode "scm: pln-formula-abduction")
         (ListLink
            (InheritanceLink
               (VariableNode "$A")
               (VariableNode "$B")
            )
            (InheritanceLink
               (VariableNode "$A")
               (ConceptNode "X")
            )
            (InheritanceLink
               (VariableNode "$B")
               (ConceptNode "X")
            )
            (VariableNode "$A")
            (VariableNode "$B")
            (ConceptNode "X")))))

And here's the error:
ERROR: In procedure cog-fc-em: BindLink consists of multiple disconnected components! (/home/eddie/opencog/atomspace/opencog/query/PatternMatch.cc:323)

Note that this error is thrown in the forward chainer, but is not thrown through use of (cog-bind). This is because cog-bind leads to bindlink->imply() being called with the check_connectivity argument set to false, so with cog-bind checking for connected components doesn't occur. In the forward chainer check_connectivity gets set to the default of true, and the error is thrown.

ptv, stv, ftv values are not checking for strength to be between [0, 1]

guile> (define foo (stv 748357403 1))

guile> (cog-tv->alist foo)
((count . 4473923584.0) (mean . 748357376.0) (confidence . 0.9999998211860657))
guile> (define bar (stv 748357403 17584760854376))

guile> (cog-tv->alist bar)
((count . 4473923584.0) (mean . 748357376.0) (confidence . 0.9999998211860657))

This might be the wanted feature of stv as it is being used differently by different codebases. But, ptv and ftv shouldn't, and if I am not mistaken ptv should have confidence2count method similar to https://github.com/opencog/atomspace/blob/master/opencog/atomspace/FuzzyTruthValue.cc#L122 maybe with a different formula

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.