Skip to main content

Searching Entanglement

In this section, we will go over several ways to search the Entanglement graph. We will cover the following topics:

.. contents:: :local:

Searching on the Web Application

The easiest way to search the Entanglement graph is to use the web application. You can access the web application at app.geodesic.seerai.space. Log in if prompted and click the top hex button to open up the Entanglement page. At the top of the page, you will find the search bar and project selector.

Image

To search, simply select the project you would like to search in with the drop down, then type in the search bar and press enter. The results will be displayed in the graph below. You can click on a node to bring up the radial menu to see more information about it. When entering a search query, the terms will be matched against all text found in the node's name, alias, description, keywords, and item fields. The search is case insensitive and will return all nodes that contain any of the search terms.

Advanced Search Features

While this is useful for quick searches, it may return a lot of extra nodes that you are not interested in. To apply more search filters, you can use advanced search features. This allows you to use binary operators like AND, OR, and NOT to filter the results. You can also specify which field you would like to search in specifically. For example, if you only want to search in the name field, you can use the syntax name:'search term'. The format always follows <field name>:'<search terms>' for term search and for exact matches follows <field name>='<exact match>'. Note the quotes around the search term. Single or double quotes are both acceptable. Field names can also be any one of the qulifiers defined on a node such as domain, category, or type. Here are some more examples:

  • name:'landsat' - Search for nodes with the name field containing 'landsat'
  • name='landsat-8' - Search for nodes with the name field exactly matching 'landsat-8'
  • alias:'landsat' AND domain='earth-observation' - Search for nodes with the alias field containing 'landsat' and the domain field exactly matching 'earth-observation'
  • name:'suncor' AND NOT description:'corporate' - Search for nodes with the name field containing 'suncor' and the description field not containing 'corporate'

Searching in the Python API

The Geodesic Python API can also be used to search the Entanglement graph. This is perfect for working inside of a Jupyter notebook or when running scripts. To search the graph, use the

geodesic.entanglement.object.get_objects method in the entanglement package:

This will search in the default project, or whatever project is set to active in the API.

import geodesic

geodesic.set_active_project('global')

# Search for nodes with the name field containing 'landsat'
results = geodesic.get_objects(search='landsat')

# Print the results
for result in results:
print(f'{result.alias}: {result.description}')


You can also specify a list of projects to search in by passing the projects argument:

results = geodesic.get_objects(search='landsat', projects=['global', 'my_project'])


The search field also follows the same rules as the web application search bar. For example:

results = geodesic.get_objects(search='name:"landsat" OR domain:"earth-observation"')


The full GraphQL API is also available in the Python API. To use the GraphQL API, use the entanglement.graphql package:

from geodesic.entanglement import graphql

# Run a query to find all nodes with the name field containing 'landsat'
query = """
{
graph(projects: ["global"], search: "landsat") {
...objectParts
connections(predicate: "links") {
...connectionParts
}
}
}
"""

# Run the query
results = graphql.graph(query)

# Print the results
for result in results['graph']:
print(f'{result["name"]}: {result["description"]}')


Notice that the same fragments in the Web Application are used in the Python API.