Find Entry#
The Entry
is the main and most atomic entity in metacatalog. A set of metadata that describes one datasource of unique data type is described as Entry
. In cases, where more than one Entry
need to be grouped together to provide useful information, a n:m
relation from Entry
to EntryGroup
s can be created. Depending on the kind of connection between the entries, EntryGroup
s are futher described by EntryGroupType
s.
Entry#
- metacatalog.api.find_entry(return_iterator: typing_extensions.Literal[False] = False, as_result: typing_extensions.Literal[False] = False) List['Entry'] #
- metacatalog.api.find_entry(return_iterator: typing_extensions.Literal[True] = False, as_result: bool = False) Query
- metacatalog.api.find_entry(return_iterator: typing_extensions.Literal[False] = False, as_result: typing_extensions.Literal[True] = False) List[ImmutableResultSet]
Find an meta data Entry on exact matches. Entries can be identified by id, title, external_id and version. The version can be added to all other matching types, which are mutually exclusive.
Changed in version 0.1.8: string matches now allow
'%'
and'*'
wildcards and can be inverted by prepending!
Changed in version 0.2.14: Can be returned as ImmutableResultSet now.
Changed in version 0.3.9: By setting include_partial to True, the API can now find partial Entries. This does only make sense in combination with
as_result=True
, to lazy-load the complete record.Changed in version 0.7.4: New arugment
coauthor
introduced, which is a functional replacement for the now deprecated ‘contributor’ argument.Deprecated since version 0.7.4: The contributor keyword is deprecated and will change its behavior in a future release. Use the new
coauthor
argument from now on.- sessionsqlalchemy.Session
SQLAlchemy session connected to the database.
- idinteger
Database unique ID of the requested record. Will return only one record.
- uuidstr
New in version 0.1.13.
Find by version 4 UUID. If uuid is given, all other options will be ignored.
- titlestr
Title attribute of the Entry.
- abstractstr
New in version 0.1.8.
Abstract attibute of the Entry.
Note
The abstract is usually a full text and the FIND operation uses exact matches. Therefore be sure to use a wildcard
api.find_entry(session: 'Session', abstract='*phrase to find*')
- licensestr, int
New in version 0.2.2.
The license can be a
License
, its id (int) or the short_title (str).- variablestr, int
New in version 0.2.2.
The variable can be a
Variable
, its id (int) or the name (str).- external_idstr
External id attrinbute of the Entry.
- versionint, str
Changed in version 0.2: The default value is now ‘latest’
Version number of the Entry. Can be combined with the other matching parameters, as they might not be different between versions. If version == ‘latest’, only the latest version will be found. If None, all version are integrated.
- projectint, str
New in version 0.2.2.
- `
The project can be a
EntryGroup
ofEntryGroupType.name=='Project'
, its id (int) or title (str)- authorint, str
New in version 0.2.2.
The author can be a
Person
, his id (int) or name (str). A string argument will match first and last names. The author is only the first author. For other coauthor seecoauthor
.- coauthorint ,str
New in version 0.7.4.
The coauthor can be a
Person
, his id (int) or name (str). A string argument will match first and last names. A co author is anyone associated as first or co-author. For first author only, seeauthor
.- contributorint, str
New in version 0.2.2.
Deprecated since version 0.7.4: This argument will change its behavior with a future release. Use
coauthor
as a repalcement.The contributor can be a
Person
, his id (int) or name (str). A string argument will match first and last names. A contributor is anyone associated as first or co-author. For first author only, seeauthor
.- keywordslist of str, int
New in version 0.2.2.
The entries can be filtered by tagged controlled keywords. The given keyword or list of keywords will be matched against the value (str) or id (int). If more than one is given, the entries need to be tagged by all keywords. An
OR
search is not possible, through the API.- detailsdict
..versionadded:: 0.2.2
Entries can be filtered by additional details. The details need to be specified as dictioniares of
name=value
pairs. If more than one pair is given, the query will combine the pairs byAND
. AnOR
search is not possible, through the API. Search for value only, using a wildcard for the key*=value
.- include_partialbool
New in version 0.3.9.
Include partial entries into the response. Defaults to False.
Note
Partial Entries might not be usefull, as they can miss important metadata. Thus, it is highly recommended to set
as_result=True
. Then, the returnedImmutableResultSet
will lazy-load the sibling informations and merge them- by_geometrystr, list
New in version 0.2.10.
The passed argument can be a WKT (string) or a list of numbers. If three numbers are passed, this is interpreted as a center point and a buffer distance in meter. If four numbers are passed, this is a bounding box. If a 2D-list of lists is passed (with two numbers), this will be used to construct a search Polygon. Finally the constructed geometry is used to apply a spatial filter to the results.
- as_resultbool
If True, the reuslts will be merged into a
ImmutableResultSet
. Defaults to False. Will be ignored if return_iterator is True- return_iteratorbool
If True, an iterator returning the requested objects instead of the objects themselves is returned.
- recordslist
List of matched Entry or ImmutableResultSet.
Entry-Group#
- metacatalog.api.find_group(return_iterator: typing_extensions.Literal[False] = False, as_result: typing_extensions.Literal[False] = False) List['EntryGroup'] #
- metacatalog.api.find_group(return_iterator: typing_extensions.Literal[True] = False, as_result: bool = False) Query
- metacatalog.api.find_group(return_iterator: typing_extensions.Literal[False] = False, as_result: typing_extensions.Literal[True] = False) List[ImmutableResultSet]
Find a group of entries on exact matches. Groups can be identified by id, title or its type.
Changed in version 0.1.8: string matches now allow ‘%’ and ‘*’ wildcards and can be inverted by prepending !
Changed in version 0.2.14: Can be returned as ImmutableResultSet now.
- Parameters:
session (sqlalchemy.Session) – SQLAlchemy session connected to the database.
id (integer) – Database unique ID of the requested record. Will return only one record.
uuid (str) –
New in version 0.1.13.
Find by version 4 UUID. If uuid is given, all other options will be ignored.
title (str) – Title attribute of the group.
type (int, str) – Either the id or name of a group type to exact match.
return_iterator (bool) – If True, an iterator returning the requested objects instead of the objects themselves is returned.
as_result (bool) – If True, the reuslts will be merged into a
ImmutableResultSet
. Defaults to False. Will be ignored if return_iterator is True
- Returns:
records – List of matched EntryGroup or ImmutableResultSet.
- Return type:
list
Group type#
- metacatalog.api.find_group_type(return_iterator: typing_extensions.Literal[False] = False) List['EntryGroupType'] #
- metacatalog.api.find_group_type(return_iterator: typing_extensions.Literal[True] = False) Query
Find a group type on exact matches. The group types describes a collection of entries.
Changed in version 0.1.8: string matches now allow ‘%’ and ‘*’ wildcards and can be inverted by prepending !
- Parameters:
session (sqlalchemy.Session) – SQLAlchemy session connected to the database.
id (integer) – Database unique ID of the requested record. Will return only one record.
name (str) – Name attribute of the group type.
return_iterator (bool) – If True, an iterator returning the requested objects instead of the objects themselves is returned.
- Returns:
records – List of matched EntryGroupType instance.
- Return type:
list of metacatalog.EntryGroupType