Wolfram Language

Property Paths for Entities

SPARQL supports property paths, which facilitates navigating an RDF (Resource Description Framework) dataset along a list of predicates. Version 12 introduces support for applying SPARQL queries to entity domains.

To start simple, get the capital city of Germany, using convenient Entity syntax.

Do the same using SPARQL.

Find the population of the capital of Germany, using Entity syntax.

Again the same using SPARQL.

SPARQL in this case looks like an unnecessary overhead, but see what happens if you do a reverse query: a query that restricts the capital city population and makes the country a placeholder.

This can be done using the new functions FilteredEntityClass in combination with EntityFunction.

To get the population, again use an EntityFunction.

Here is the same query using SPARQL.

Related Examples

de es fr ja ko pt-br zh