Project:Sample queries

From MaRDI portal
Revision as of 11:21, 19 May 2025 by Admin (talk | contribs) (Created page with "== About == This page is meant to provide example queries for users of the SPARQL endpoint at [https://query.portal.mardi4nfdi.de/ https://query.portal.mardi4nfdi.de/]. The ticket [https://phabricator.wikimedia.org/T387064 https://phabricator.wikimedia.org/T387064 ] tracks progress in this regard. == Local SPARQL queries == === DLMF formulas that depend indirectly on the gamma function === {{SPARQL| query= #title: DLMF formulas that depend indirectly on the gamma func...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

About

This page is meant to provide example queries for users of the SPARQL endpoint at https://query.portal.mardi4nfdi.de/. The ticket https://phabricator.wikimedia.org/T387064 tracks progress in this regard.

Local SPARQL queries

DLMF formulas that depend indirectly on the gamma function

#title: DLMF formulas that depend indirectly on the gamma function

PREFIX wdt: <https://portal.mardi4nfdi.de/prop/direct/>
PREFIX wd: <https://portal.mardi4nfdi.de/entity/>

SELECT (?dep2nd as ?qid) ?dlmfid ?definesLabel ?formula
WHERE {
  ?item wdt:P4 wd:Q1818 .
         ?item wdt:P3 ?defines .
       ?dep2nd wdt:P4 ?defines 
       FILTER( NOT EXISTS { ?dep2nd wdt:P4 wd:1818.})
         OPTIONAL{?dep2nd wdt:P2 ?dlmfid .}
                OPTIONAL{?dep2nd wdt:P14 ?formula .}      
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }

      }
Limit 10
DLMF formulas that depend indirectly on the gamma function

Federated SPARQL queries

Federation within MaRDI

Federation with NFDI knowledge graphs outside MaRDI

Street addresses of historic mathematicians in Paris

#title: Street addresses of historic mathematicians in Paris
# This federated query combines data from 
# https://query.portal.mardi4nfdi.de (the MaRDI portal's knowledge graph)
# and 
# https://database.factgrid.de (NFDI4Memory's FactGrid)

#defaultView:Map

# MaRDI-related prefixes
PREFIX wdt: <https://portal.mardi4nfdi.de/prop/direct/>
PREFIX wd: <https://portal.mardi4nfdi.de/entity/>

# FactGrid-related prefixes
PREFIX factgrid_wd: <https://database.factgrid.de/entity/>
PREFIX factgrid_wdt: <https://database.factgrid.de/prop/direct/>

SELECT DISTINCT 
  ?factgrid_mathematician ?factgrid_mathematicianLabel ?factgrid_addressLabel ?factgrid_coord 
  ?mardi_person ?mardi_personLabel 
WHERE {
  ?mardi_person wdt:P316 ?mardi_factgrid_item_id .

  # mapping between MaRDI and FactGrid
  BIND(URI(CONCAT("https://database.factgrid.de/entity/", ?mardi_factgrid_item_id)) AS ?factgrid_mathematician)

  # start of federation to FactGrid 
  SERVICE <https://database.factgrid.de/sparql> {

    SELECT ?factgrid_mathematician ?factgrid_mathematicianLabel ?factgrid_addressLabel ?factgrid_coord
    WHERE {
      ?factgrid_mathematician factgrid_wdt:P2 factgrid_wd:Q7;       # person
                              factgrid_wdt:P208 ?factgrid_address.  # address
      ?factgrid_address factgrid_wdt:P48 ?factgrid_coord;           # geocoordinates
                        factgrid_wdt:P47 factgrid_wd:Q10441 .       # place: Paris
      SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". } 
    }
    LIMIT 100

  }
  # end of federation to FactGrid 

  BIND(?factgrid_mathematicianLabel AS ?mathematicianLabel)

  BIND(STR(CONCAT("mardi: ", STR(?mathematicianLabel))) AS ?mardi_personLabel)  
}
Street addresses of historic mathematicians in Paris

Federation beyond NFDI

Federation with Wikidata