FeederPublisher Class

The FeederPublisher class provides an abstraction for ontologenius feeder topic. More...

Ros1 Package: ontologenius
Ros2 Package: ontopy
Inherits: ClientBase

Methods

__init__(self, name)
addObjectRelation(self, concept_from, property, concept_on, stamp = None)
addDataRelation(self, concept_from, concept_property, type, data, stamp = None)
addInheritage(self, child, parent, stamp = None)
addLanguage(self, concept_from, lang, name, stamp = None)
addConcept(self, concept_from, stamp = None)
removeRelation(self, concept_from, property, stamp = None)
removeObjectRelation(self, concept_from, property, concept_on, stamp = None)
removeDataRelation(self, concept_from, property, type, data, stamp = None)
removeInheritage(self, concept_from, concept_on, stamp = None)
removeLanguage(self, concept_from, lang, name, stamp = None)
removeConcept(self, concept_from, stamp = None)
int getNumSubscribers(self)
waitConnected(self)
bool waitUpdate(self, timeout = 100000000)
str commitAuto(self, timeout = 100000000)
bool commit(self, commit_name, timeout = 100000000)
bool checkout(self, commit_name, timeout = 100000000)
registerNotificationCallback(self, callback)
bool export(self, path)
bool doVersioning(self)
int getNbUncommitedData(self)
str getCurrentCommit(self)
bool compareCommits(self, commit_from, commit_to = "")

Detailed Description

The FeederPublisher class provides an abstraction ontologenius feeder(insert) ROS topic.

Working in a closed world can be interesting, but with ontologenius, you can also choose to work in an open world by adding and modifying the agent's knowledge base during its operation. The feeder publisher is used to insert and delete knowledge dynamically. The feeding process is asynchronous and therefore does not guarantee any response time. It still provides functions to synchronize if you have applications where you have to query the ontology right after having modified it.

All modifications can be time-stamped for advanced uses using the republication mechanism.

Methods Documentation

__init__(self, name)

Constructs a FeederPublisher.

Can be used in a multi-ontology mode by specifying the name of the ontology name(str). For classic use, name(str) should be defined as ''.

addObjectRelation(self, concept_from, property, concept_on, stamp = None)

Adds the fact that concept_from(str) is linked with concept_on(str) by the property property(str).

At least concept_from or concept_on must be already known to the system. If one of them is unknown, it will be automatically created. The property can be unknown before calling this function.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

addDataRelation(self, concept_from, concept_property, type, data, stamp = None)

Adds the fact that concept_from(str) is linked to the data data(str) of type type(str) by the property property(str).

concept_from must be already known to the system. The property can be unknown before calling this function.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

addInheritage(self, child, parent, stamp = None)

Adds the inheratage : child(str) is a parent(str). child and parent could by a class, an individual or a property.

At least child or parent must be already known to the system. If one of them is unknown, it will be automatically created.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

addLanguage(self, concept_from, lang, name, stamp = None)

Adds the label name(str) in the language lang(str) the class, individual, or property concept_from(str).

concept_from must be already known to the system.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

addConcept(self, concept_from, stamp = None)

Adds the class or individual concept_from(str).

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

removeRelation(self, concept_from, property, stamp = None)

Removes the fact that concept_from(str) is linked to any object by the property property(str).

After this action, knowledge of the property is not removed.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

removeObjectRelation(self, concept_from, property, concept_on, stamp = None)

Removes the fact that concept_from(str) is linked with concept_on(str) by the property property(str).

After this action, knowledge of the property is not removed.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

removeDataRelation(self, concept_from, property, type, data, stamp = None)

Removes the fact that concept_from(str) is linked to the data data(str) of type type(str) by the property property(str).

After this action, knowledge of the property is not removed.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

removeInheritage(self, concept_from, concept_on, stamp = None)

Removes the inheratage : concept_from(str) is a concept_on(str). concept_from and concept_on could by a class, an individual or a property.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

removeLanguage(self, concept_from, lang, name, stamp = None)

Removes the label name(str) in the language lang(str) the class, individual, or property concept_from(str).

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

removeConcept(self, concept_from, stamp = None)

Removes the class or individual concept_from(str).

All inheritance, properties, and labels applied to concept_from are also removed.

If the time stamp stamp (rostime) is not defined, the function takes the current ROS time as the time stamp.

getNumSubscribers(self)

Returns the number of subscribers (int) that are currently connected to the internal ROS publisher.

waitConnected(self)

Blocks while no subscribers are currently connected to the internal ROS publisher.

waitUpdate(self, timeout = 100000000)

Waits until all changes have been applied.

The default parameter timeout(int) is the expiration time in milliseconds. The default value is of 100 seconds.

Returns False if the function returns on a timeout.

commitAuto(self, timeout = 100000000)

Saves all the modifications from the previous commit and waits until all changes have been applied.

The default parameter timeout(int) is the expiration time in milliseconds. The default value is of 100 seconds.

Returns the commit id (str) and an empty string if the function returns on a timeout.

This function can only be used on a copied ontology.

commit(self, commit_name, timeout = 100000000)

Saves all the modifications from the previous commit with a specific id commit_name (str) and waits until all changes have been applied.

The default parameter timeout(int) is the expiration time in milliseconds. The default value is of 100 seconds.

Returns False if the function returns on a timeout.

This function can only be used on a copied ontology.

checkout(self, commit_name, timeout = 100000000)

Apply the necessary changes to return to the specified commit_name (str) and waits until all changes have been applied.

The default parameter timeout(int) is the expiration time in milliseconds. The default value is of 100 seconds.

Returns False if the function returns on a timeout.

This function can only be used on a copied ontology.

registerNotificationCallback(self, callback)

Register a callback function to get notifications from the reasoners.

The parameter callback is the callback function taking a string.

export(self, path)

Exports the current modification tree in the absolute path(str) path. The path parameter must be of the form: my/path/to/file.xml

This function has no effect on non copied ontologies.

Returns False if the service call fails.

doVersioning(self)

Returns True if versionning is available on the given instance.

getNbUncommitedData(self)

On versionned instances, this function returns the number of uncomited data (data published since the last commit).

getCurrentCommit(self)

On versionned instances, this function returns the identifier of the current parent commit.

compareCommits(self, commit_from, commit_to = "")

On versionned instances, this function compares commit_from(str) and commit_to(str). If both commit have received the same modifications, the function return true.

If commit_to is not set, the current state will be use instead (with uncommited data).