Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add methods to declare atom types in Python modules dynamically #2787

Merged
merged 1 commit into from
Feb 13, 2021

Conversation

vsbogd
Copy link
Contributor

@vsbogd vsbogd commented Feb 13, 2021

No description provided.

@linas linas self-requested a review February 13, 2021 22:14
Copy link
Member

@linas linas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

What do you plan to do with this?

@linas linas merged commit 33c578f into opencog:master Feb 13, 2021
@linas
Copy link
Member

linas commented Feb 13, 2021

I merged because this is simple enough that it didn't seem to need discussion....

I still would like to know .. what do you plan to use this for?

@vsbogd
Copy link
Contributor Author

vsbogd commented Feb 14, 2021

I would like to create new Node and Link types for experiments but using cmake infrastructure in Python project is not convenient. Dynamic atom types creation should be used with caution with atomspace persistence layer, but I think we will not use persistence in experiment scripts. And after that we will think about approach. If code is shared between Scheme and Python it is better to introduce new atoms as separate C module.

I hope new atom types will simplify atomspace queries. Atom types can be designated using InheritanceLinks or EvalutionLinks but this approach is more verbose.

@vsbogd vsbogd deleted the add-dynamic-atom-type-constructors branch February 15, 2021 09:46
@linas
Copy link
Member

linas commented Feb 20, 2021

Dynamic atom types creation should be used with caution with atomspace persistence layer,

This should mostly-kind-of work. The postgres layer stores atom types as numbers, and has an atom-name-to-number lookup table. If the SQL tables know about an atom type that the C++ code does not, it is ignored. (this should be changed so that the unknown type is created, which is not easy because the SQL tables do not store the inheritance hierarchy.)

The RocksDB stores atom types by name. I'm not sure what happens if the RocksDB holds an atom type that the C++ code does not know about. The RocksDB does not store the atom type hierarchy. This should be fixed. BTW RocksDB is 3x or 5x or 10x faster than postgres!

If the above two are fixed, then it might happen that python still won't know about the new atom types. I don't know how that works. Similar remarks for scheme.

See #2789 and opencog/atomspace-rocks#6 and #2790 and #2791

new atom types will simplify atomspace queries

Yes, they would.

Atom types can be designated using InheritanceLinks or EvalutionLinks but this approach is more verbose.

Yes. The wiki details the theory of this in greater detail but that theory is not really implemented. Even though it is more verbose, it might make it easier to interface with PLN and/or other subsystems. That is, it should be possible to "introspect" atom types in Atomese. To examine the type hierarchy by running an ordinary BindLink/GetLink. No one has needed this, yet. Hmmm This might be the easiest way to extend new atom types into persistence!?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants