Internalfunctions - SmartSlog KP Library
Macros | Functions
classes.h File Reference

Describe functions for work with classes. More...

#include "structures.h"
#include "utils/kp_debug.h"

Go to the source code of this file.

Macros

#define SSLOG_EXTERN

Functions

SSLOG_EXTERN individual_tsslog_new_individual (const class_t *classtype)
 Create new individual.
SSLOG_EXTERN list_t * sslog_get_superclass_all (const class_t *ont_class)
 Returns a list of superclasses.
SSLOG_EXTERN int sslog_is_subclass_of (const class_t *ont_class, const class_t *super_class)
 Checks if class has superclass.
SSLOG_EXTERN int sslog_is_classtype_of (const individual_t *individual, const class_t *prent_class)
 Checks type of individual.
SSLOG_EXTERN int sslog_rep_count_individual_references (individual_t *individual)
 Count references to given individual.
SSLOG_EXTERN int sslog_set_individual_uuid (individual_t *ind, const char *uuid)
 Set UUID.
SSLOG_EXTERN int sslog_repo_add_entity (void *entity)
 Add entity to repository.
SSLOG_EXTERN int sslog_repo_add_class (class_t *ont_class)
 Add class to class repository.
SSLOG_EXTERN int sslog_repo_add_property (property_t *property)
 Add property to property repository.
SSLOG_EXTERN void sslog_repo_remove_entity (void *entity)
 Remove entity from repository.
SSLOG_EXTERN void sslog_repo_clean_all ()
SSLOG_EXTERN const property_tsslog_repo_get_property_by_name (const char *name)
 Get property from repository by given name.
SSLOG_EXTERN const class_tsslog_repo_get_class_by_classtype (const char *classtype)
 Get class from repository by given classtype.
SSLOG_EXTERN const individual_tsslog_repo_get_individual_by_uuid (const char *uuid)
 Get individuals from repository by given uuid.
SSLOG_EXTERN const list_t * sslog_repo_get_individual_by_classtype_all (const char *classtype)
 Get individuals from repository by given classtype.

Detailed Description

Describe functions for work with classes.

Alexandr A. Lomov lomov.nosp@m.@cs..nosp@m.karel.nosp@m.ia.r.nosp@m.u

Date:
05 December, 2009

LICENSE

SmartSlog KP Library is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

SmartSlog KP Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with SmartSlog KP Library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

DESCRIPTION

Describe functions for work with classes. This file is part of SmartSlog KP Library.

Copyright (C) 2009 - Alexandr A. Lomov. All rights reserved.


Macro Definition Documentation

#define SSLOG_EXTERN

Function Documentation

SSLOG_EXTERN list_t* sslog_get_superclass_all ( const class_t ont_class)

Returns a list of superclasses.

Parameters:
classclass.
Returns:
list of superclasses on success or NULL otherwise.
SSLOG_EXTERN int sslog_is_classtype_of ( const individual_t individual,
const class_t ont_class 
)

Checks type of individual.

Parameters:
individualobject of some class for check.
ont_classallaged class of individual.
Returns:
returns 1 if the individual is object of given class, 0 if no and -1 on error.
SSLOG_EXTERN int sslog_is_subclass_of ( const class_t subclass,
const class_t superclass 
)

Checks if class has superclass.

Parameters:
classclass for check.
superclassalleged superclass of class.
Returns:
1 if the class is a subclass of superclass, 0 if no and -1 on error.
SSLOG_EXTERN individual_t* sslog_new_individual ( const class_t ont_class)

Create new individual.

Create new individual without UUID.

Parameters:
classtypetype of class.
Returns:
individual of given class type on success or NULL otherwise.
SSLOG_EXTERN int sslog_rep_count_individual_references ( individual_t individual)

Count references to given individual.

It gets other individuals and search references to individual from their properties.

Parameters:
individualindividual for count.
Returns:
count of references.
SSLOG_EXTERN int sslog_repo_add_class ( class_t ont_class)

Add class to class repository.

It set error and return it on failure.

Parameters:
ont_classclass for insert.
Returns:
ERROR_NO on success or not otherwise.
SSLOG_EXTERN int sslog_repo_add_entity ( void *  entity)

Add entity to repository.

It set error and return it on failure. You need to add individual, if you create it manually. Function

See also:
sslog_new_individual() add individual to repository automatically.
Parameters:
entityindividual, property or class.
Returns:
ERROR_NO on success or not otherwise.
SSLOG_EXTERN int sslog_repo_add_property ( property_t property)

Add property to property repository.

It set error and return it on failure.

Parameters:
propertyfor insert.
Returns:
ERROR_NO on success or not otherwise.
SSLOG_EXTERN void sslog_repo_clean_all ( )
SSLOG_EXTERN const class_t* sslog_repo_get_class_by_classtype ( const char *  classtype)

Get class from repository by given classtype.

Parameters:
classtypename of classtype.
Returns:
class from repository or NULL if it not found.
SSLOG_EXTERN const list_t* sslog_repo_get_individual_by_classtype_all ( const char *  classtype)

Get individuals from repository by given classtype.

Parameters:
classtypename of classtype.
Returns:
individuals list or NULL if not found. Do not free list.
SSLOG_EXTERN const individual_t* sslog_repo_get_individual_by_uuid ( const char *  uuid)

Get individuals from repository by given uuid.

Parameters:
uuidindividual's uuid.
Returns:
individual or NULL if it not found.
SSLOG_EXTERN const property_t* sslog_repo_get_property_by_name ( const char *  name)

Get property from repository by given name.

Parameters:
nameproperty name.
Returns:
property from repository or NULL if it not found.
SSLOG_EXTERN void sslog_repo_remove_entity ( void *  entity)

Remove entity from repository.

Parameters:
entityindividual, class or property.
SSLOG_EXTERN int sslog_set_individual_uuid ( individual_t ind,
const char *  uuid 
)

Set UUID.

Set new UUID for individuals. You need reinitialize individual to work with SS.

Parameters:
indindividual.
uuidUUID.
Returns:
ERROR_NO on success or error code otherwise.