In [1]:
from mdf_forge.forge import Forge # This is the only required import for Forge.
In [2]:
# You can set up Forge with no arguments. Forge will automatically authenticate and connect to MDF.
mdf = Forge()
In [3]:
res = mdf.search("Al")
res[0]
Out[3]:
You can also query more precisely with the advanced=True
argument. The basic use is the form key.subkey:value
. The full documentation for the query syntaz can be found here: http://globus-search-docs.s3-website-us-east-1.amazonaws.com/stable/api/search.html#_query_syntax
In this example, we can search for "Al" inside the "mdf.elements" key.
We're also going to limit the number of results to 10.
In [4]:
res = mdf.search("material.elements:Al", advanced=True, limit=10)
res[0]
Out[4]:
If you want to search on a value with special characters, such as a colon or space, you must wrap the value in double quotes. Otherwise, you may get unexpected results.
In [5]:
res = mdf.search('dc.titles.title:"High-throughput Ab-initio Dilute Solute Diffusion Database"', advanced=True)
res[0]
Out[5]:
In [ ]: