Deep Query

Sometimes data can be spread across multiple pages, so clicking around to find the data you need can be tedious. Deep Query lets you create queries to find the information you need in a single click.

Example of a Deep Query.

Query Language

Deep Query uses SPARQL for its query language. You'll need to familiarise yourself with its syntax. If you get the syntax wrong, the editor will provide hints to help resolve them.

Resource Identifiers

All resources inside the database are referenced in SPARQL as "IRIs"; essentially URLs.

IRIs are long, so use PREFIX to shorten them. For convenience, the default query includes all prefixes.

Below is a list of resource types, how to reference them with prefixes, along with some examples.

Wiki

PREFIX w: <https://frontiernav.net/wiki/>

You can find the wiki identifier by the URL while at a wiki.

For example w:xenoblade-chronicles-x is the Xenoblade Chronicles X wiki.

Query Multiple Wikis

By default WHERE uses the current wiki's resources. The below query adds a second wiki to its query using the SERVICE syntax. It lists collectibles in Xenoblade Chronicles which are also available in its Future Connected expansion.

SELECT ?collectible
FROM w:xenoblade-chronicles
WHERE {
  ?collectible a et:Collectible .
  ?collectible p:name ?name .
  SERVICE w:xenoblade-chronicles-future-connected {
    [] xcfc_p:name ?name
  }
}

You can also use the FROM NAMED syntax.

SELECT ?collectible
FROM w:xenoblade-chronicles
FROM NAMED w:xenoblade-chronicles-future-connected
WHERE {
  ?collectible a et:Collectible .
  ?collectible p:name ?name .
  GRAPH w:xenoblade-chronicles-future-connected {
    [] xcfc_p:name ?name
  }
}

When using multiple wikis, you will need to specify additional prefixes to access that wiki's resources.

PREFIX xc1_p: <https://frontiernav.net/wiki/xenoblade-chronicles/properties/>
PREFIX xc2_p: <https://frontiernav.net/wiki/xenoblade-chronicles-2/properties/>

Wiki Resources

The IRI for wiki resources are prefixed by the wiki identifier. For the examples below, replace wiki-id with the appropriate wiki identifier.

For example, Xenoblade Chronicles X's wiki identifier is xenoblade-chronicles-x so its resources looks like <https://frontiernav.net/wiki/xenoblade-chronicles-x/properties/description>.

Entity Type, Category, Table

PREFIX et: <https://frontiernav.net/wiki/wiki-id/types/>

You can find the entity type identifier by the URL while at a category page.

For example t:Collectible is the "Collectible" category. The below matcher will only match entities under the Collectible category.

?collectible se:type t:Collectible .

Property, Column

PREFIX p: <https://frontiernav.net/wiki/wiki-id/properties/>

You can find the identifier for each property predicate by hovering over their columns in the database view.

For example, all tables have a Name column which has a name identifier, so its IRI is <https://frontiernav.net/wiki/wiki-id/properties/name> or p:name.

Entity, Row, Page

PREFIX e: <https://frontiernav.net/wiki/wiki-id/entities/>

You can find the entity identifier by the URL while at an entity page.

Generally, accessing entities directly isn't too useful. If you don't know the entity identifier, you can match a property to find it.

?collectible p:name ?name .

Relationship

PREFIX r: <https://frontiernav.net/wiki/wiki-id/relationships/>

You can access relationship data similar to entities using properties as predicates.

To traverse relationships, use "blank nodes" syntax to avoid creating intermediate variables for relationships. For example, we can go from a collectible, through its weather relationship property and get the weather's name in a single line.

?collectible p:Collectible-WEATHER [sr:end [p:name ?weather]] .

Relationship Type

PREFIX rt: <https://frontiernav.net/wiki/wiki-id/relationshipTypes/>

Generally, you won't need to directly reference relationship types in your query.

Schema Resources

The above resources are used to access wiki-specific resources. To access metadata such as identifiers, timestamps and pointers, you'll need to use schema resources.

Database Schema

PREFIX s: <https://frontiernav.net/schema/>
IRI
Description
Example

s:type

The schema type of the subject.

s:entityType
s:relationshipType
s:entity
s:relationship

Entity Schema

PREFIX se: <https://frontiernav.net/schema/entity/>
IRI
Description
Example

se:id

The entity indentifier

e:gem

se:type

The entity type of this entity.

et:Collectible

se:updatedAt

When this entity was last changed.

2025-01-01T00:00:00.000Z

Relationship Schema

PREFIX sr: <https://frontiernav.net/schema/relationship/>
Predicate
Description
Example

sr:id

The relationship indentifier

r:gem__Collectible-RARITY__rare

sr:type

The relationship type of this relationship.

rt:Collectible-RARITY

sr:updatedAt

When this relationship was last changed.

2025-01-01T00:00:00.000Z

sr:start

The start entity of this relationship.

e:gem

sr:end

The end entity of this relationship.

e:rare

Entity Type Schema

Not yet supported.

Relationship Type Schema

Not yet supported.

Example Query

The below query for Xenoblade Chronicles X lists all collectibles in Sylvalum along with their time and weather conditions. It uses a range of resources and SPARQL features such as:

  • "Blank nodes" using [ and ]for streamlined relationship traversal.

  • FILTER to show only a specific region.

  • OPTIONALfor showing the description when it's available. Without it, it will only show rows with descriptions.

PREFIX s: <https://frontiernav.net/schema/>
PREFIX se: <https://frontiernav.net/schema/entity/>
PREFIX sr: <https://frontiernav.net/schema/relationship/>
PREFIX et: <https://frontiernav.net/wiki/xenoblade-chronicles-x/types/>
PREFIX e: <https://frontiernav.net/wiki/xenoblade-chronicles-x/entities/>
PREFIX p: <https://frontiernav.net/wiki/xenoblade-chronicles-x/properties/>

SELECT DISTINCT ?collectible ?rarity_name ?time ?weather ?description
WHERE {
  ?collectible se:type et:Collectible .
  ?collectible p:CollectibleArea-CONTAINS-Collectible [sr:start [p:Region-CONTAINS-CollectibleArea [sr:start ?region]]] .
  FILTER (?region=e:sylvalum)
  ?collectible p:Collectible-RARITY [sr:end ?rarity_name] .
  ?collectible p:Collectible-TIME [sr:end ?time] .
  ?collectible p:Collectible-WEATHER [sr:end ?weather] .
  OPTIONAL{?collectible p:description ?description .}
}
LIMIT 10
?name
?rarity_name
?time
?weather
?description

Taoman Acid

Rare

Early Morning

Rain

A chemical produced when rainwater reacts with an unknown airborne substance. It's harmless for living organisms, but can dissolve most inorganic matter.

Mizaria Celery

Prime

Early Morning

Rain

A rare type of celery that arises only from the crevices of deceased fauna soaked by incessant rain. Its taste depends entirely on the type of carcass from which it grew.

Camocloak

Unique

Early Morning

Rain

The cloth used to make this cloak imitates its surroundings. It looks to have been invented by an advanced civilization that has since gone extinct.

L-002 Dagoo Heat Ray

Prime

Early Morning

Rain

A high-energy laser mounted on the White Whale. It has since been decommissioned, but the scars of battle still stain its scorched barrel.

Rainy Cricket

Unique

Early Morning

Rain

A giant cricket that sleeps in the sand and rarely ventures above the surface. Aggressive in its short waking hours, it will attack on sight.

Antorus Rose

Rare

Early Morning

Rain

A rose with petals that can be used as dyes—which can then be combined to form any color on the spectrum. It is said that these vivid colors will never fade.

Last updated

Was this helpful?