Question regarding the types&inferrence of traits on the Cypher API

Hello,
I am currently working on the EoL API using cypher queries.
I am listing for a number of species, the different traits EoL records.
I know their is different types: measurement, inferred ones … and this include different traits like diet info, range info or simple morphological info, derrived from different sources…
I am listing ALL the traits avialable, but I still want to indicate what “kind” of trait it is.
Currently I am using this Query:
MATCH (p:Page)-[:trait|inferred_trait]->(t0:Trait)-[:predicate]->(t:Term)
WHERE p.page_id = 485904
RETURN DISTINCT t.name, p.canonical, p.page_id, t.uri, t.type LIMIT 900;

Do you know of any RETURN argument which could help me ?
I added t.type also, but it doesn’t tell me oif the trait is inferred or not …
Sincerely,
QN.

By the way, the ID selected here is purely random (I am working on marine species).

There are a few things you could add, depending on what categories you want to distinguish. Our measurementTypes vocabulary must cover a broad landscape, since we draw from such a wide variety of sources, so you’ll probably find it messy. There are a few things you can do, eg:

MATCH (p:Page)-[:trait|inferred_trait]->(t0:Trait)-[:predicate]->(t:Term)
WHERE p.page_id = 485904
OPTIONAL MATCH (t0)-[:metadata]->(m:MetaData)--(:Term {name:“inherited from”})
RETURN DISTINCT t.name, p.canonical, p.page_id, t.uri, t.type, m.measurement
LIMIT 900;

where a value of m.measurement is returned, that is the taxon ID of the source taxon for a taxonomically inferred trait. If the value is null, the trait is not taxonomically inferred. This will slow down your queries quite a bit, I think. Alternatively, you can use just one relationship in your first line,
-[:trait]->
OR
-[:inferred_trait]->
making two separate queries. The first will give you only direct traits, the second only inferred traits.

Provenance of each record is recorded in several fields (for online data source, primary citation, multiple cited references, and individual human agents). That part of the data model is covered pretty well at https://github.com/EOL/publishing/blob/master/doc/query-examples.md#provenance-of-trait-record

MeasurementTypes are also organized in a hierarchy, so you can gather them by superclass, either in your initial queries, or after the fact, organizing them by t.name. Example:

MATCH (p:Page)-[:trait|inferred_trait]->(t0:Trait)-[:predicate]->(t:Term),
(t)-[:parent_term|synonym_of*0…]->(:Term{ name: “size” }),
(t)-[:units_term]->(units:Term)
WHERE p.page_id = 46559751
RETURN DISTINCT t.name, t0.measurement, units.name
LIMIT 3

You can get the entire parent-child measurementType hierarchy using

MATCH (t:Term {type:“measurement”})-[:parent_term|synonym_of*0…]->(parent:Term)
RETURN DISTINCT parent.name, parent.uri, t.name, t.uri
LIMIT 900;

Some of the relationships may surprise you. They are meant to support search tasks. The intent is, if you asked for X, you may also be interested in Y.

As our categorization of measurementType terms may not serve your purposes as is, you may find it easiest to collect your data by measurementType name and organize those names as a separate task. The provenance and the inferred status of a record are both independent of measurementType, and need to be considered separately.

Good luck!

Jen