SPARQL query service/queries/examples/en: Difference between revisions

From MiMoText
Jump to navigation Jump to search
Line 9: Line 9:
SELECT all the items and their labels WHERE the author is Tiphaigne de la Roche  
SELECT all the items and their labels WHERE the author is Tiphaigne de la Roche  


{{SPARQL|query=#select - where: Select all items where the author is Tiphaigne de la Roche
{{SPARQL|query=#title:novels by Tiphaigne de la Roche, with labels
#title:novels by Tiphaigne de la Roche, with labels
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>  
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>  

Revision as of 10:42, 13 December 2023

Basic functions

select - where: Select all items where the author is Tiphaigne de la Roche

SELECT all the items and their labels WHERE the author is Tiphaigne de la Roche

#title:novels by Tiphaigne de la Roche, with labels
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 

SELECT ?item ?itemLabel
WHERE 
{
  ?item mmdt:P2 mmd:Q2. # item is instance of literary work
  ?item mmdt:P5 mmd:Q940. # item has author Tiphaigne de la Roche
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
novels by Tiphaigne de la Roche, with labels

Bind: Publication years of the novels

Retrieve the publication years of the novels.

#title:Publication years of the novels
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?work ?workLabel ?year  #display work as Link, the Label and the year
WHERE
{
   ?work mmdt:P2 mmd:Q2.
   ?work mmdt:P9 ?pubyear . # P9 : date of publication
   ?work rdfs:label ?workLabel . # get the label of your item (work)
   FILTER(lang(?workLabel) = "fr") . # filter the language, otherwise you will get triple the amount of results
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], fr". }
   BIND(YEAR(?pubyear) as ?year). # extract the year of the datetime-formatted ?pubyear and bind it to ?year
}

ORDER BY ?year # sort the results by ascending (default) year
Publication years of the novels

Count: Count all novels written by an author

This query counts all novels written by the authors within the MiMoTextBase.

#title:count of written novels per author
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?authorName (count (?authorName) as ?count)
WHERE {
  ?work mmdt:P2 mmd:Q2. # item is instance of literary work
   ?work mmdt:P5 ?author . # work has author.
   ?author rdfs:label ?authorName . # get author label (not only URL to author)
   FILTER(LANG(?authorName) = "en") # other options: "fr", "de". Filter is needed as there is more than one label (language dependent)
}

group by ?authorName
order by desc (?count)
count of written novels per author

Limit: Authors and their count of novels limited to top 10

Authors and novels limited to top 10 This query takes all items whose value of BGRF_tone_intention (P31) is MYLNE, Vivienne Gower (Q5) and count the total number of items using COUNT function.


#title:Authors and their count of novels limited to top 10
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?authorName (count (?authorName) as ?count)
WHERE {
   ?work mmdt:P5 ?author . # work has author.
   ?author rdfs:label ?authorName . # get author label (not only Link to author)
   FILTER(LANG(?authorName) = "en") . # other options: "fr", "de". Filter is needed as there is more than one label (language dependent)
}

group by ?authorName
order by desc (?count)
limit 10
Authors and their count of novels limited to top 10

Filter: Filter for all authors that published a novel in 1800

Filter for all authors that published a novel in 1800

#title:authors that published a novel in 1800
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT DISTINCT ?authorName (YEAR(?pubdate) as ?year)
WHERE {
  ?work mmdt:P2 mmd:Q2;
        mmdt:P5 ?author; 
        mmdt:P9 ?pubdate. # work has author and a publication date
  ?author rdfs:label ?authorName . # get author label (not only Link to author)
  FILTER(LANG(?authorName) = "en"). # other options: "fr", "de". Filter is needed as there is more than one label (language dependent)
  FILTER(YEAR(?pubdate) = 1800). # filter for the publication date of interest
}
authors that published a novel in 1800

Filter: Get all authors whose name contains “beau”

Get all authors whose name contains “beau”

  1. title:Authors whose name contains "beau"

PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/> PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

#title:Authors  whose name contains "beau"
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?authorName ?author
WHERE {
  ?author mmdt:P11 mmd:Q11 . # item has property "occupation"(P11) namely "author"(Q11).
  ?author rdfs:label ?authorName . # get author label (not only URL to author)
  FILTER(LANG(?authorName) = "fr") .
  FILTER(CONTAINS(LCASE(?authorName), "beau")).
}
Authors whose name contains "beau"

Optional: Novels by François-Thomas-Marie de Baculard d’ARNAUD and their tonality if available

Get all novels written by François-Thomas-Marie de Baculard d’ARNAUD and their tonality

#title:Novels by François-Thomas-Marie de Baculard d’ARNAUD
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT ?work ?workLabel ?tonality 
WHERE
{
  ?work mmdt:P5 mmd:Q68 # work has author François-Thomas-Marie de Baculard d’ARNAUD  
  OPTIONAL { ?work mmdt:P31 ?tonality. }
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
}
Novels by François-Thomas-Marie de Baculard d’ARNAUD

Get all Items that have Matches to wikidata

Example on how to use the "Close Match" or "Exact Match" properties to query the MiMoText database.

#title:Items with a close match to other knowledge graphs
#defaultView:Dimensions
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT
   ?item ?itemLabel ?value 
WHERE
{
  ?item mmdt:P16 ?value #items with property "close match“, substitute mmdt:P13 for exact match, other relational properties see Wiki
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Items with a close match to other knowledge graphs

List all Properties

This shows how to list all properties defined in the database.

#title:List of all properties used in the MiMoText graph
prefix mmd:<http://data.mimotext.uni-trier.de/entity/> 
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT ?property ?propertyLabel ?prop
WHERE {
    ?property a wikibase:Property . 
    SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE]". }
    BIND(STRAFTER(STR(?property), "entity/") as ?prop)
}
ORDER BY ASC(xsd:integer(STRAFTER(STR(?property), 'P')))
List of all properties used in the MiMoText graph

Basic Data Extraction: Overview over some data and handling of missing data statements

This query shows hoe to extract data from our database by querying different properties of authors. It is also an example on how to handle missing values (see comments).

#title: Some data about the MiMoTextBase such as Authors, Novels, publication years, tone etc.

# Prefix declarations for shortening URIs
prefix mmd: <http://data.mimotext.uni-trier.de/entity/>
prefix mmdt: <http://data.mimotext.uni-trier.de/prop/direct/> 

# Selecting distinct data fields for analysis
SELECT DISTINCT ?bgrf ?item ?authorlabel ?itemLabel ?year ?narrpers ?tonality ?pages ?normalized WHERE {
  ?item mmdt:P5 ?author;   # Who is the author?
        mmdt:P4 ?title;    # What is the title?
        mmdt:P22 ?bgrf;    # What is the identifier in the bibliographic metadata?
        mmdt:P9 ?date;     # What is the publication date?

  # Optional data fields for more details (some novels may not have these)
  OPTIONAL { ?item mmdt:P27 ?narrpers. } # Narrator's perspective
  OPTIONAL { ?item mmdt:P31 ?tonality. }  # Tone or writing style
  OPTIONAL { ?item mmdt:P25 ?pages.   }   # Number of pages

  # Extracting the year from the publication date
  BIND(YEAR(?date) as ?year).

  # Handling cases where narrpers is not available
  BIND(if(bound(?narrpers), ?narrpers, "unbekannt") as ?normalized)

  # Fetching the author's label in English
  ?author rdfs:label ?authorlabel.
  FILTER(LANG(?authorlabel) = "en")

  # Wikibase service for label translation
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], fr". }
} ORDER BY ?year
Some data about the MiMoTextBase such as Authors, Novels, publication years, tone etc.

Authors

Timeline: authors and their novels on a timeline by publication date

This query finds and displays the first 100 authors found in the database in a timeline.

#title:Authors on a timeline, limited to 100 results
#defaultView:Timeline{"hide":["?date"]}
#line above necessary to display results in a time line! 
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>
Select ?authorlabel ?titel (YEAR(?date) as ?year) ?date 
where{
 ?item mmdt:P2 mmd:Q2;
       mmdt:P5 ?author;
       mmdt:P9 ?date;
       mmdt:P4 ?titel .
 ?author rdfs:label ?authorlabel .
 FILTER(lang(?authorlabel) = "fr") .
 SERVICE wikibase:label {bd:serviceParam wikibase:language "{AUTO_LANGUAGE}".}
}LIMIT 100
Authors on a timeline, limited to 100 results

Authors with most novels published (top 20)

Get the twenty authors that have written the most novels that are within the MiMoTextBase

#title:Authors with most novels published (top 20)
prefix mmd:<http://data.mimotext.uni-trier.de/entity/> 
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT ?authorName (count (?authorName) as ?count)
WHERE {
   ?work mmdt:P5 ?author . # work has author.
   ?author rdfs:label ?authorName . # get author label (not only Link to author)
   FILTER(LANG(?authorName) = "en") # other options: "fr", "de". Filter is needed as there is more than one label (language dependent)
 } 
group by ?authorName
order by desc (?count)
limit 20
Authors with most novels published (top 20)

Timeline of authors, their Wikidata matches and birth dates

This shows the authors and their birth dates on a timeline using federated queries.

#title:Timeline of authors, their Wikidata matches and birth dates 
#defaultView:Timeline
PREFIX wd: <http://www.wikidata.org/entity/> #wikidata prefix definition for entity
PREFIX wdt: <http://www.wikidata.org/prop/direct/> #wikidata prefix definition for property
prefix mmd:<http://data.mimotext.uni-trier.de/entity/> #mimotext prefix for entity is wd
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> #mimotext prefix for property is wdt
Select ?author ?authorLabel ?wikiLink ?birth ?image 
{
  ?author mmdt:P11 ?occupation.
  ?author mmdt:P13 ?wikiLink.
  ?author rdfs:label ?authorLabel
  Filter(lang(?authorLabel) = "en")
          
  SERVICE <https://query.wikidata.org/sparql> {
    ?wikiLink wdt:P569 ?birth. 
 OPTIONAL{   ?wikiLink wdt:P18 ?image.}

  }          
}
Timeline of authors, their Wikidata matches and birth dates

Novels

Novels per Author

This query shows how to extract authors who have written more than 10 novels. See comments on how to modify this query to extract every author and how many novels they have written in general.

#title:Authors with more than 10 novels
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/> 
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?authorName (count (?authorName) as ?count)
WHERE {
   ?work mmdt:P5 ?author . # work has author.
   ?author rdfs:label ?authorName . # get author label (not only URL to author)
   FILTER(LANG(?authorName) = "en") # other options: "fr", "de". Filter is needed as there is more than one label (language dependent)
} 

group by ?authorName
having (count(?authorName) > 10) #can be left out to get count of written novels per author a limit can be added eg limit 20
order by desc (?count)
Authors with more than 10 novels

Publication Years

This query shows how to query the publication year of the novels in the database. Keep in mind, that this (and other) information is presented in three different languages ("en", "de", "fr") in the database, it is very important to filter the results using one of them.

#title:Publication years of the novels
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?work ?workLabel ?year  #display work as Link, the Label and the year
WHERE
{
   ?work mmdt:P2 mmd:Q2. # item is instance of literary work
   ?work mmdt:P9 ?pubyear . # P9 : date of publication
   ?work rdfs:label ?workLabel . # get the label of your item (work)
   FILTER(lang(?workLabel) = "fr") . # filter the language, otherwise you will get triple the amount of results
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], fr". }
   BIND(YEAR(?pubyear) as ?year). # extract the year of the datetime-formatted ?pubyear and bind it to ?year
}

ORDER BY ?year # sort the results by ascending (default) year
Publication years of the novels

Narrative Perspective

This query is for displaying the different narrative perspectives present in the database in a Bar Chart. See comments for querying the narrative perspective of each individual novel.

#title:Narrative perspectives of the novels
#defaultView:BarChart
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
SELECT (count(?narrativePerspectiveLabel) as ?count) ?narrativePerspectiveLabel 
WHERE
{
  ?work mmdt:P2 mmd:Q2. # item is instance of literary work
  ?work mmdt:P33 ?narrativePerspective. # work (novel) has property P33 (narrative perspective)
  ?narrativePerspective rdfs:label ?narrativePerspectiveLabel. # using of rdfs:label to display labels
  
  FILTER(lang(?narrativePerspectiveLabel) = "en") # filter is neccessary to display only one occurence. Other possibilites would be "en" or "de".
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], en". }
 
}group by ?narrativePerspectiveLabel
Narrative perspectives of the novels

Distribution Formats

This shows how to display the different distribution formats and how many novels have this property in a Bar Chart.

#title:Distribution formats of publications
#defaultView:BarChart
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
Select  (str(SAMPLE(year(?date))) as ?year) (count(?format) as ?count) ?format 
   WHERE{
   ?item mmdt:P26 ?format.
   ?item mmdt:P9 ?date .
  FILTER(lang(?format) = "fr")
# FILTER(lcase(?format) = "12-in"@fr)
      Filter (regex(lcase(?format), "in-\\d+[\\s\\S]"))
   BIND(str(year(?date)) as ?year)
   SERVICE wikibase:label {bd:serviceParam wikibase:language "{AUTO_LANGUAGE}","fr" .}
  }

GROUP BY ?format ?year ?count
#having (?count> 2)
Distribution formats of publications

Narrative Locations

This queries the different narrative locations that are present in the database.

#title:Distinct narrative locations in the corpus
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>
SELECT  DISTINCT ?locLabel ?loc # use distinct to get all results only one time
 WHERE 
 {
    ?work mmdt:P32 ?loc . 
    ?loc rdfs:label ?locLabel .
   FILTER (LANG(?locLabel) = "en").
 }
 ORDER BY ?locLabel
Distinct narrative locations in the corpus

Tone of the novels shown as a TreeMap

This shows the tone of each novel present in the database in a Tree Map.

#title:Tone of the novels
#defaultView:TreeMap
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT
  ?tonality ?itemLabel
WHERE
{
  ?item mmdt:P31 ?tonality. #tonality        
  ?item mmdt:P9 ?date. 
   SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],fr". }
}
Tone of the novels

Count all novels by year of first Publication

This shows how to extract the first publication dates of all French novels in the database and group the results per year.

#title:First publication dates of all French novels 1751-1800
prefix mmd:<http://data.mimotext.uni-trier.de/entity/> 
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT (str(SAMPLE(year(?date))) as ?year) (COUNT(*) AS ?count)
WHERE {
   ?item mmdt:P2 mmd:Q2.
   ?item mmdt:P9 ?date .
}
GROUP BY ?date
ORDER BY DESC(?date)
First publication dates of all French novels 1751-1800

Narrative locations of epistolary novels

This shows how to get the narrative location of epistolary novels.

#title:Settings of epistolary novels
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT ?narr_loc_name (count(*) as ?count) where {
  ?item mmdt:P33 mmd:Q42; # get novels that have narrative form "epistolary"
        mmdt:P32 ?narrative_location .
  ?narrative_location rdfs:label ?narr_loc_name .
  filter(lang(?narr_loc_name) = "en")
}

group by ?narr_loc_name
order by desc(?count)

#defaultView:BubbleChart
Settings of epistolary novels

Dimension View: Token Count of the novels and their narrative Form

This shows the dimension (or relation) between token count and narrative form.

#title:Dimension between token count and narrative form
#defaultView:Dimensions
prefix mmd:<http://data.mimotext.uni-trier.de/entity/> 
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT ?tokencount ?formLabel WHERE {
  ?novel mmdt:P40 ?tokencount.
  ?novel mmdt:P33 ?form.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Dimension between token count and narrative form

Themes

Show all thematic concepts within the MiMoTextBase as a BubbleChart and count their occurrences

This query shows how to get a list of all themes with their corresponding QID and occurence.

#title:List of all themes with corresponding Q-identifier & occurrence 
#defaultView:BubbleChart
prefix mmd:<http://data.mimotext.uni-trier.de/entity/> 
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>
SELECT  ?theme
        (sample(?themeLabel) as ?name)
        (count(*) as ?count) 
WHERE {
  ?item mmdt:P2 mmd:Q2.
  ?item mmdt:P36 ?theme. # item is about a topic
  ?theme rdfs:label ?themeLabel .
  FILTER (LANG(?themeLabel) = "en").
}
GROUP BY ?theme
ORDER BY DESC(?count)
List of all themes with corresponding Q-identifier & occurrence


Query Specific Theme that authors wrote about: sentimentalism

View all authors who wrote novels about a specified theme in a Bubble Chart.

#title:Authors with novels about sentimentalism
#defaultView:BubbleChart
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/> 
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT ?name (COUNT(*) as ?count) WHERE {
  ?item mmdt:P2 mmd:Q2;
        mmdt:P36 mmd:Q3085 ; # item is about sentimentalism
        mmdt:P5 ?author .
  ?author rdfs:label ?name . 
  FILTER(lang(?name) = "en")
}
GROUP BY ?name
ORDER BY DESC (?count)
Authors with novels about sentimentalism

Show all places of publications of novels that are about travel

View all publication places of novels about a specified theme in a World Map.

#title:Publication places of novels about "travel"
#defaultView:Map{"hide": ["?nar_loc", "?topic"], "layer": "?themeLabel"}
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
PREFIX wd: <http://www.wikidata.org/entity/> #wikidata wd
PREFIX wdt: <http://www.wikidata.org/prop/direct/> #wikidata wdt

SELECT DISTINCT ?item ?itemLabel ?placeOfPub ?placeOfPubLabel ?wikidataEntityLink ?coordinateLocation ?theme ?themeLabel WHERE {
  ?item mmdt:P36 mmd:Q3126.  # about travel
  ?item mmdt:P36 ?theme.    # work with 0 or more topics
  ?item mmdt:P10 ?placeOfPub.  # work has place publication
  ?placeOfPub mmdt:P13 ?WikiLink.  # place of publication ist mit Wikidata-Link verknüpft
  #Federated Query -> Wikidata
  SERVICE <https://query.wikidata.org/sparql> {
    ?WikiLink wdt:P625 ?coordinateLocation .
  }
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
}
Publication places of novels about "travel"


Get the topics of all novels that have the narrative location rural area

This shows how to extract themes from the database given a specific narrative location (here: rural area).

#title:Themes of novels set in "rural areas"
#defaultView:TreeMap
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/> 
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 

SELECT ?theme ?themeLabel ?item ?itemLabel WHERE {
  ?item mmdt:P2 mmd:Q2.
  ?item mmdt:P36 ?theme .
  ?item mmdt:P32 mmd:Q3243 # items with narrative location (P32): rural area
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Themes of novels set in "rural areas"

Spaces

Places of publication over the time as a barchart

#title:Change of publication places over time
#defaultView:BarChart
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?year ?placelabel (COUNT(*) as ?countyearplace) WHERE {
  ?item mmdt:P10 ?place.
  ?place rdfs:label ?placelabel .
  ?item mmdt:P9 ?date .
  FILTER(lang(?placelabel) = "fr")
  BIND(str(year(?date)) as ?year)
  SERVICE wikibase:label {bd:serviceParam wikibase:language "{AUTO_LANGUAGE}","fr" .}
}

GROUP BY ?year ?placelabel
HAVING (?countyearplace > 1)
Change of publication places over time

Publication Places on a Map using federated queries

#title:Most common publication places
#defaultView:Map{"hide": ["?pub_loc"]}
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
PREFIX wd: <http://www.wikidata.org/entity/> #wikidata wd
PREFIX wdt: <http://www.wikidata.org/prop/direct/> #wikidata wdt

SELECT DISTINCT ?item ?itemLabel ?pub_loc ?pub_locLabel ?wikidataEntityLink ?coordinateLocation ?theme ?themeLabel WHERE {
  ?item mmdt:P10 ?pub_loc.
  ?pub_loc mmdt:P13 ?WikiLink.
  #Federated Query -> Wikidata
  SERVICE <https://query.wikidata.org/sparql> {
    ?WikiLink wdt:P625 ?coordinateLocation
  }      
  SERVICE wikibase:label {
    bd:serviceParam wikibase:language "en" .
  }
Most common publication places

Federated queries

Narrative locations, their Wikidata matches and geographic coordinates

This query shows how to display the narrative (or publication) locations using the world map by extracting coordinate locations from Wikidata. Every time information from Wikidata is required, a federated query is necessary. Optionally, an added layer of token count can be added.

#title:Narrative places (using Wikidata coordinate locations)
#defaultView:Map{"hide": ["?nar_loc"], "markercluster":"true"}
#remove {"hide": ["?nar_loc"], "markercluster":"true"} if publication locations are queried
PREFIX wd: <http://www.wikidata.org/entity/> #wikidata wd
PREFIX wdt: <http://www.wikidata.org/prop/direct/> #wikidata wdt
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT DISTINCT ?item ?itemLabel ?nar_loc ?nar_locLabel ?WikiDataEntity ?coordinateLocation
WHERE { ?item mmdt:P32 ?nar_loc. # change mmdt:P10 if publication locations are of interest
  ?nar_loc mmdt:P13 ?WikiDataEntity.
  #Federated Query -> Wikidata
  SERVICE <https://query.wikidata.org/sparql> {
    ?WikiDataEntity wdt:P625 ?coordinateLocation
  }           
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
}
Narrative places (using Wikidata coordinate locations)

Authors and their images using federated query to wikidata

This query shows pictures of authors that are present in the MiMoText base and in Wikidata.

#title:Authors in the MiMoTextBase with exact Wikidata match and Wikidata image
#defaultView:ImageGrid
PREFIX mmd: <http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt: <http://data.mimotext.uni-trier.de/prop/direct/>
PREFIX wd: <http://www.wikidata.org/entity/> 
PREFIX wdt: <http://www.wikidata.org/prop/direct/> 

SELECT ?author ?authorLabel ?img
WHERE {
  ?author mmdt:P11 mmd:Q11;
          mmdt:P13 ?wikiLink.
  SERVICE <https://query.wikidata.org/sparql>{
  ?wikiLink wdt:P18 ?img.
  } 
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Authors in the MiMoTextBase with exact Wikidata match and Wikidata image

Change over time

Display change of narrative forms over Time

This query will show changes in narrative forms in a Bar Chart.

#title:Change of narrative forms over time 
#defaultView:BarChart
prefix mmd:<http://data.mimotext.uni-trier.de/entity/> 
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
#defaultView:BarChart
Select  (str(SAMPLE(year(?date))) as ?year) (count(?formLabel) as ?count) ?formLabel 
   WHERE{
   ?item mmdt:P33 ?form.
   ?form rdfs:label ?formLabel .
   ?item mmdt:P9 ?date .
   FILTER(lang(?formLabel) = "en")
   BIND(str(year(?date)) as ?year)
   SERVICE wikibase:label {bd:serviceParam wikibase:language "en".}
  }

GROUP BY ?formLabel ?year ?count
Change of narrative forms over time

Evolution of "travel" theme in French novels 1751-1800 as relative frenquency

This query will display the changes in a specific theme (here: travel) over time in a Bar Chart.

#title:Evolution of "travel" theme in French novels 1751-1800
#defaultView:BarChart
prefix mmd:<http://data.mimotext.uni-trier.de/entity/> 
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
SELECT ?date ?countTravel ?countAll (?countTravel / ?countAll AS ?rel)
WHERE {
 {  
   # Subquery to count novels with the "travel" theme
    SELECT ?date (count(*) AS ?countTravel)
    WHERE {
      ?item mmdt:P9 ?date;
            mmdt:P36 ?topic .
      ?topic rdfs:label ?topicLabel .
      # Filtering for English labels with "travel"
      FILTER(lang(?topicLabel) = "en")
      FILTER(lcase(?topicLabel) = "travel"@en)
    }
    GROUP BY ?date
  }
  {
    # Subquery to count all novels
   SELECT ?date (count(*) AS ?countAll)
   WHERE {
     ?item mmdt:P9 ?date;
         mmdt:P36 ?topic . 
     ?topic rdfs:label ?topicLabel .
     filter(lang(?topicLabel) = "en")
   }
   GROUP BY ?date
 }
}
Evolution of "travel" theme in French novels 1751-1800

Comparing sources

Topics of novels that are referenced by both Topic Modeling and bibliographic metadata

#Title:Statements on consistent topics in novels from both sources (TM & bibl. metadata)
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
prefix mmps:<http://data.mimotext.uni-trier.de/prop/statement/>
prefix mmpr: <http://data.mimotext.uni-trier.de/prop/reference/>
PREFIX mmp: <http://data.mimotext.uni-trier.de/prop/>
SELECT   ?item ?itemLabel ?value ?valueLabel
WHERE
{   
    ?item mmp:P36 ?statement.
    ?statement mmps:P36 ?value .
    ?statement prov:wasDerivedFrom ?refnode. #statement has a reference
    ?refnode mmpr:P18 mmd:Q21.  #reference statement uses 'P18'='stated in' topic modeling
  
    ?statement prov:wasDerivedFrom ?refnodeB.
    ?refnodeB mmpr:P18 mmd:Q1 .#reference statement uses 'P18'='stated in' bibliographie
    
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
¡Pruébalo! (es) / Próbáld ki! (hu) / ¡Pruébalo! (ast) / Prova-ho! (ca) / Es kann versucht werden! (de-ch) / Ceisio! (cy) / Try it! (en-gb) / Փորձի՛ր (hy) / 试一试! (zh) / Prøv det! (da) / Deneyin! (tr) / 試す! (ja) / Testa! (sv) / Versuchen Sie es! (de-formal) / 試一試! (zh-hant) / Versuche es! (de) / Kokeile! (fi) / Δοκιμάστε το! (el) / Provu ĝin! (eo) / Zkuste to! (cs) / Isprobajte! (bs) / Provalo! (it) / এটি চেষ্টা করে দেখুন! (bn) / Essayez ! (fr) / پرشن کرو (pnb) / Паспрабуйце! (be-tarask) / de-at (1) / Виконати! (uk) / נסו את זה! (he) / SPARQL 쿼리 실행하기 (ko) / Biceribîne! (ku) / Probeer! (nl) / Experimenta! (pt) / ਪ੍ਰਸ਼ਨ ਕਰੋ (pa) / Izmēģini! (lv) / Prøv sjølv (nn) / Испробајте! (sr) / Cobalah! (id) / Пробајте! (mk) / Experimente! (pt-br) / جالنکن! (ms-arab) / ทดลองใช้ (th) / Wypróbuj! (pl) / Prøv selv! (nb) / 試試看! (zh-tw) / Jalankan! (ms) / Încercați! (ro) / Выполнить запрос (ru) / Provoje (sq) / Run it! (en) / تجربة! (ar) / 试一试! (zh-hans) / Оскалтэ! (udm)


Get all works and authors in which Topic and Topic interest match

#title:Get all works and authors in which Topic and Topic interest match
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 

SELECT DISTINCT ?item ?itemLabel ?author ?authorLabel ?topic ?topicLabel WHERE {
  
  ?item mmdt:P2 mmd:Q2;
        mmdt:P5 ?author; # item has an author
        mmdt:P36 ?topic.
  
  ?author mmdt:P47 ?topic. # author has topic interest that is the same as topic
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
Get all works and authors in which Topic and Topic interest match

Visualizations

Bubble Chart: topics exctracted via Topic Modelling

Here, you can display the different topics present in the database in a Bubble Chart.

#title:Topics referenced by topic modeling (Q21)
#do not delete following line. it looks like a comment but is important for the presentation of the results as a Bubble Chart.
#defaultView:BubbleChart
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 
prefix mmps:<http://data.mimotext.uni-trier.de/prop/statement/>
prefix mmpr:<http://data.mimotext.uni-trier.de/prop/reference/>
SELECT ?themeLabel
        (count(*) as ?count) 
WHERE
{
    ?statement mmps:P36 ?theme. #statement has property 'about'
    ?statement prov:wasDerivedFrom ?refnode. #statement has a reference
    ?refnode   mmpr:P18 mmd:Q21. #reference statement uses 'P18'=stated in; stated in: Q21. use mmd:Q1 to see topics referenced by Bibliographie du genre romanesque français
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
GROUP BY ?themeLabel
ORDER BY ?name
Topics referenced by topic modeling (Q21)

Line Chart: Average Token Count

This example shows hoe you can display information in different Charts. Here, you can see the average token count for each possible narrative form/year.

#title:average token count for each possible narrative form per year
#defaultView:LineChart
#replace LineChart with BarChart or ScatterChart if you prefer that presentation of your data
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 

SELECT ?year (avg(?tokencount) as ?avgtokencount) ?narrForm ?narrFormLabel
  WHERE{
    ?item mmdt:P9 ?publicationdate. # get publication date
    ?item mmdt:P40 ?tokencount. # get tokencount
    BIND(str(YEAR(?publicationdate)) as ?year). # extract year from pubdate
    ?item mmdt:P33 ?narrForm. # get narrative form
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
  }
GROUP BY ?narrForm ?year ?narrFormLabel
ORDER BY ?year
average token count for each possible narrative form per year

Animated Bar Chart: Count of different Tone per Intention over the years

This is a way to dynamically display information that is dependent on more than one variable. Here, the count of different tones per intention is shown. The Bar Chart is animated and changes as the years go on.

#title:Count of different tones per intention and year (animated)
#defaultView:BarChart
PREFIX mmd: <http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt: <http://data.mimotext.uni-trier.de/prop/direct/>
SELECT ?intentionLabel (COUNT(?tone) AS ?toneCount) ?toneLabel ?year
WHERE{
  ?item mmdt:P2 mmd:Q2; # item is instance of literary work
        mmdt:P9 ?pubdate; # get the publication date
        mmdt:P38 ?tone; # get tone of work-item
        mmdt:P39 ?intention. # get intention of work-item
  ?tone rdfs:label ?toneLabel. # get the tone label
  ?intention rdfs:label ?intentionLabel. # get the intention label
  
  FILTER(LANG(?toneLabel) = "en"). # filter for language
  FILTER(LANG(?intentionLabel)="en"). # filter for language
  BIND(str(YEAR(?pubdate)) as ?year). # filter year of the publication date
}
GROUP BY ?year ?toneLabel ?intentionLabel
Count of different tones per intention and year (animated)

Area Chart: Publication Places

This example shows how to display information in an Area Chart. Here, the publication places with at least 5 instances per year are queried.

#title:Publication places that occur at least 5 times per year
#defaultView:AreaChart
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?date (count(?pubPlace) as ?count) ?pubPlaceLabel
WHERE{
  ?item mmdt:P2 mmd:Q2;
        mmdt:P9 ?date;
        mmdt:P10 ?pubPlace.
  ?pubPlace rdfs:label ?pubPlaceLabel.
  FILTER(LANG(?pubPlaceLabel) = "en").
}

GROUP BY ?date ?pubPlaceLabel
HAVING (count(?pubPlaceLabel) > 4)
Publication places that occur at least 5 times per year

Tree: Authors, their novels and topics as expandable list

Here is an example on how to display information in an expandable list. The result will be a list of authors with the second level being their works, and the third being the topic labels of these works.

#title:Authors, their novels and thematic concepts
#defaultView:Tree
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?author ?authorLabel
?item ?itemLabel 
?topic ?topicLabel

WHERE{
  ?item mmdt:P2 mmd:Q2;  # item is instance of literary work
        mmdt:P36 ?topic; # item has a thematic concept
        mmdt:P33 ?narrForm; # item has a narrative form
        mmdt:P5 ?author.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }

}ORDER BY ?authorLabel
Authors, their novels and thematic concepts

Graph: Authors and their Membership in Organizations

This is how to display information in an intricate Graph. Here, the authors in the MiMoText database are queried and are connected to the societies they were members. To identify their membership, federated queries are used to extract that information from Wikidata. The organization should have at least two members that are also within the MiMoTextBase

#defaultView:Graph
#title:MiMoText authors that are members of an organisation having at least two members who are in the MiMoTextBase
PREFIX wd: <http://www.wikidata.org/entity/> #wikidata wd
PREFIX wdt: <http://www.wikidata.org/prop/direct/> #wikidata wdt
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/> 

SELECT ?author ?authorLabel ?img ?memberOf ?memberOfLabel 
WHERE {
  ?author mmdt:P11 mmd:Q11. 
  ?author mmdt:P13 ?WikiLink. #important for federated query!
  
  #federated query: extracts the organization the author is a member of and optionally their picture
  SERVICE <https://query.wikidata.org/sparql> {
    ?WikiLink wdt:P463 ?memberOf.
    ?memberOf rdfs:label ?memberOfLabel.
    OPTIONAL{?WikiLink wdt:P18 ?img}.
    FILTER(LANG(?memberOfLabel)="en").
  }   
        
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en" . }
  {
    #Count the number of authors for each organization and include only those with more than 1 author
    SELECT ?memberOf (COUNT(?author) as ?countmember) 
    WHERE {
      ?author mmdt:P11 mmd:Q11.
      ?author mmdt:P13 ?WikiLink.
      SERVICE <https://query.wikidata.org/sparql> {
        ?WikiLink wdt:P463 ?memberOf.
      }           
    }
  GROUP BY ?memberOf
  HAVING (?countmember > 1)
  }
}
MiMoText authors that are members of an organisation having at least two members who are in the MiMoTextBase

Queries about secondary literature and references

List the labels of all secondary literature used in the MiMoTextBase

Here is an example on how to display information in an expandable list. The result will be a list of authors with the second level being their works, and the third being the topic labels of these works.

PREFIX mmdt: <http://data.mimotext.uni-trier.de/prop/direct/>
PREFIX mmd: <http://data.mimotext.uni-trier.de/entity/>
PREFIX mmpr: <http://data.mimotext.uni-trier.de/prop/reference/>

# List all labels of secondary literature that we have statements for

SELECT DISTINCT ?refLabel WHERE {
  
  ?statement prov:wasDerivedFrom ?refnode. # a statement was derived from the reference node.
  ?refnode mmpr:P18 ?ref. # the reference node as the property "stated in" (P18) any reference.
  ?ref mmdt:P2 mmd:Q3. # the reference is of instance scholary work
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
¡Pruébalo! (es) / Próbáld ki! (hu) / ¡Pruébalo! (ast) / Prova-ho! (ca) / Es kann versucht werden! (de-ch) / Ceisio! (cy) / Try it! (en-gb) / Փորձի՛ր (hy) / 试一试! (zh) / Prøv det! (da) / Deneyin! (tr) / 試す! (ja) / Testa! (sv) / Versuchen Sie es! (de-formal) / 試一試! (zh-hant) / Versuche es! (de) / Kokeile! (fi) / Δοκιμάστε το! (el) / Provu ĝin! (eo) / Zkuste to! (cs) / Isprobajte! (bs) / Provalo! (it) / এটি চেষ্টা করে দেখুন! (bn) / Essayez ! (fr) / پرشن کرو (pnb) / Паспрабуйце! (be-tarask) / de-at (1) / Виконати! (uk) / נסו את זה! (he) / SPARQL 쿼리 실행하기 (ko) / Biceribîne! (ku) / Probeer! (nl) / Experimenta! (pt) / ਪ੍ਰਸ਼ਨ ਕਰੋ (pa) / Izmēģini! (lv) / Prøv sjølv (nn) / Испробајте! (sr) / Cobalah! (id) / Пробајте! (mk) / Experimente! (pt-br) / جالنکن! (ms-arab) / ทดลองใช้ (th) / Wypróbuj! (pl) / Prøv selv! (nb) / 試試看! (zh-tw) / Jalankan! (ms) / Încercați! (ro) / Выполнить запрос (ru) / Provoje (sq) / Run it! (en) / تجربة! (ar) / 试一试! (zh-hans) / Оскалтэ! (udm)

Count all references per secondary literature in either literary works or authors

Here we retrieve all quotations from secondary literature and count how many references each secondary literature has.

PREFIX mmpq: <http://data.mimotext.uni-trier.de/prop/qualifier/>
PREFIX mmdt: <http://data.mimotext.uni-trier.de/prop/direct/>
PREFIX mmd: <http://data.mimotext.uni-trier.de/entity/>
prefix mmps:<http://data.mimotext.uni-trier.de/prop/statement/>
prefix mmpr: <http://data.mimotext.uni-trier.de/prop/reference/>
prefix mmp: <http://data.mimotext.uni-trier.de/prop/>

# count all references per secondary literature in either literary works or authors

SELECT ?refLabel (COUNT(?refLabel) as ?count)  WHERE {
  ?item ?p ?statement. 
  ?statement prov:wasDerivedFrom ?refnode. # get the reference node
  ?refnode mmpr:P18 ?ref. # get the reference using "stated in"
  ?refnode mmpr:P42 ?quotation. # get the quotation via "quotation"
  ?ref mmdt:P2 mmd:Q3. # reference should be instance of scholarly work
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

}
GROUP BY ?refLabel
ORDER BY DESC(?count)
¡Pruébalo! (es) / Próbáld ki! (hu) / ¡Pruébalo! (ast) / Prova-ho! (ca) / Es kann versucht werden! (de-ch) / Ceisio! (cy) / Try it! (en-gb) / Փորձի՛ր (hy) / 试一试! (zh) / Prøv det! (da) / Deneyin! (tr) / 試す! (ja) / Testa! (sv) / Versuchen Sie es! (de-formal) / 試一試! (zh-hant) / Versuche es! (de) / Kokeile! (fi) / Δοκιμάστε το! (el) / Provu ĝin! (eo) / Zkuste to! (cs) / Isprobajte! (bs) / Provalo! (it) / এটি চেষ্টা করে দেখুন! (bn) / Essayez ! (fr) / پرشن کرو (pnb) / Паспрабуйце! (be-tarask) / de-at (1) / Виконати! (uk) / נסו את זה! (he) / SPARQL 쿼리 실행하기 (ko) / Biceribîne! (ku) / Probeer! (nl) / Experimenta! (pt) / ਪ੍ਰਸ਼ਨ ਕਰੋ (pa) / Izmēģini! (lv) / Prøv sjølv (nn) / Испробајте! (sr) / Cobalah! (id) / Пробајте! (mk) / Experimente! (pt-br) / جالنکن! (ms-arab) / ทดลองใช้ (th) / Wypróbuj! (pl) / Prøv selv! (nb) / 試試看! (zh-tw) / Jalankan! (ms) / Încercați! (ro) / Выполнить запрос (ru) / Provoje (sq) / Run it! (en) / تجربة! (ar) / 试一试! (zh-hans) / Оскалтэ! (udm)


Get thematic concepts of literary work items that have at least 3 quotations from scholarly publications

This query retrieves novels and the counts of their associated P36 (about)-statements that are referenced at least three times by any scholarly work.

PREFIX mmpq: <http://data.mimotext.uni-trier.de/prop/qualifier/>
PREFIX mmdt: <http://data.mimotext.uni-trier.de/prop/direct/>
PREFIX mmd: <http://data.mimotext.uni-trier.de/entity/>
prefix mmps:<http://data.mimotext.uni-trier.de/prop/statement/>
prefix mmpr: <http://data.mimotext.uni-trier.de/prop/reference/>
prefix mmp: <http://data.mimotext.uni-trier.de/prop/>

# get all items that have the property about that have at least 3 quotations from scholarly publications

SELECT ?item ?itemLabel ?aboutLabel (COUNT(?quot) as ?count) WHERE {
  ?item mmdt:P2 mmd:Q2. # item is instance of literary work
  ?item mmp:P36 ?statement. # item has a statement group about (P36)
  ?statement mmps:P36 ?about. # get each statement for that statemet group 
  ?statement prov:wasDerivedFrom ?refnode. # the statement has a reference node
  ?refnode mmpr:P18 ?ref. # the references are references via stated in (P18)
  ?refnode mmpr:P42 ?quot. # there are quotations for the references (P42)
  ?ref mmdt:P2 mmd:Q3. # the reference is instance of scholarly work
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }

}
GROUP BY ?item ?itemLabel ?aboutLabel
HAVING (?count > 2) # filter those that have more than 2 quotations
ORDER BY DESC(?count)
¡Pruébalo! (es) / Próbáld ki! (hu) / ¡Pruébalo! (ast) / Prova-ho! (ca) / Es kann versucht werden! (de-ch) / Ceisio! (cy) / Try it! (en-gb) / Փորձի՛ր (hy) / 试一试! (zh) / Prøv det! (da) / Deneyin! (tr) / 試す! (ja) / Testa! (sv) / Versuchen Sie es! (de-formal) / 試一試! (zh-hant) / Versuche es! (de) / Kokeile! (fi) / Δοκιμάστε το! (el) / Provu ĝin! (eo) / Zkuste to! (cs) / Isprobajte! (bs) / Provalo! (it) / এটি চেষ্টা করে দেখুন! (bn) / Essayez ! (fr) / پرشن کرو (pnb) / Паспрабуйце! (be-tarask) / de-at (1) / Виконати! (uk) / נסו את זה! (he) / SPARQL 쿼리 실행하기 (ko) / Biceribîne! (ku) / Probeer! (nl) / Experimenta! (pt) / ਪ੍ਰਸ਼ਨ ਕਰੋ (pa) / Izmēģini! (lv) / Prøv sjølv (nn) / Испробајте! (sr) / Cobalah! (id) / Пробајте! (mk) / Experimente! (pt-br) / جالنکن! (ms-arab) / ทดลองใช้ (th) / Wypróbuj! (pl) / Prøv selv! (nb) / 試試看! (zh-tw) / Jalankan! (ms) / Încercați! (ro) / Выполнить запрос (ru) / Provoje (sq) / Run it! (en) / تجربة! (ar) / 试一试! (zh-hans) / Оскалтэ! (udm)

Get all references that mention "Voltaire" in the quotations on the about statements of literary works or the topic interest of authors

This query retrieves novels and the counts of their associated P36 (about)-statements that are referenced at least three times by any scholarly work.

PREFIX mmdref: <http://data.mimotext.uni-trier.de/reference/>
PREFIX mmpq: <http://data.mimotext.uni-trier.de/prop/qualifier/>
PREFIX mmdt: <http://data.mimotext.uni-trier.de/prop/direct/>
PREFIX mmd: <http://data.mimotext.uni-trier.de/entity/>
prefix mmps:<http://data.mimotext.uni-trier.de/prop/statement/>
prefix mmpr: <http://data.mimotext.uni-trier.de/prop/reference/>
prefix mmp: <http://data.mimotext.uni-trier.de/prop/>

# find all quotations that contain "Voltaire" and show all object that are contaning that quotation

SELECT DISTINCt ?item ?itemLabel ?quotation ?aboutLabel

WHERE{
  ?item ?p ?statement.
  VALUES ?value {mmps:P36 mmps:P47}
  ?statement ?value ?about.
  ?statement prov:wasDerivedFrom ?ref.
  ?ref mmpr:P18 ?refnode.
  ?ref mmpr:P42 ?quotation.
  FILTER(CONTAINS(?quotation, "Voltaire")).

  ?refnode mmdt:P2 mmd:Q3.
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
¡Pruébalo! (es) / Próbáld ki! (hu) / ¡Pruébalo! (ast) / Prova-ho! (ca) / Es kann versucht werden! (de-ch) / Ceisio! (cy) / Try it! (en-gb) / Փորձի՛ր (hy) / 试一试! (zh) / Prøv det! (da) / Deneyin! (tr) / 試す! (ja) / Testa! (sv) / Versuchen Sie es! (de-formal) / 試一試! (zh-hant) / Versuche es! (de) / Kokeile! (fi) / Δοκιμάστε το! (el) / Provu ĝin! (eo) / Zkuste to! (cs) / Isprobajte! (bs) / Provalo! (it) / এটি চেষ্টা করে দেখুন! (bn) / Essayez ! (fr) / پرشن کرو (pnb) / Паспрабуйце! (be-tarask) / de-at (1) / Виконати! (uk) / נסו את זה! (he) / SPARQL 쿼리 실행하기 (ko) / Biceribîne! (ku) / Probeer! (nl) / Experimenta! (pt) / ਪ੍ਰਸ਼ਨ ਕਰੋ (pa) / Izmēģini! (lv) / Prøv sjølv (nn) / Испробајте! (sr) / Cobalah! (id) / Пробајте! (mk) / Experimente! (pt-br) / جالنکن! (ms-arab) / ทดลองใช้ (th) / Wypróbuj! (pl) / Prøv selv! (nb) / 試試看! (zh-tw) / Jalankan! (ms) / Încercați! (ro) / Выполнить запрос (ru) / Provoje (sq) / Run it! (en) / تجربة! (ar) / 试一试! (zh-hans) / Оскалтэ! (udm)


Show a Barchart of the temporal development of the topics written about in the secondary literature

This query retrieves novels and the counts of their associated P36 (about)-statements that are referenced at least three times by any scholarly work.

#defaultView:BarChart
PREFIX mmdref: <http://data.mimotext.uni-trier.de/reference/>
PREFIX mmpq: <http://data.mimotext.uni-trier.de/prop/qualifier/>
PREFIX mmdt: <http://data.mimotext.uni-trier.de/prop/direct/>
PREFIX mmd: <http://data.mimotext.uni-trier.de/entity/>
prefix mmps:<http://data.mimotext.uni-trier.de/prop/statement/>
prefix mmpr: <http://data.mimotext.uni-trier.de/prop/reference/>
prefix mmp: <http://data.mimotext.uni-trier.de/prop/>

# show barchart of topics of novels having more than 3 quotations over the year in the secondary literature

SELECT ?year (COUNT(?quotation) as ?yearcount)  ?aboutLabel 

WHERE{
  ?item ?p ?statement.
  ?statement mmps:P36 ?about.
  ?statement prov:wasDerivedFrom ?ref.
  ?ref mmpr:P18 ?refnode.
  ?ref mmpr:P42 ?quotation.
  ?refnode rdfs:label ?refnodeLabel.
  FILTER(LANG(?refnodeLabel) ="en").
  ?refnode mmdt:P2 mmd:Q3.
  ?refnode mmdt:P9 ?date. # get publication date from secondary literature
  BIND(STR(YEAR(?date)) as ?year). # extract the year and convert it to a string
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?year ?aboutLabel
HAVING(?yearcount > 3)
¡Pruébalo! (es) / Próbáld ki! (hu) / ¡Pruébalo! (ast) / Prova-ho! (ca) / Es kann versucht werden! (de-ch) / Ceisio! (cy) / Try it! (en-gb) / Փորձի՛ր (hy) / 试一试! (zh) / Prøv det! (da) / Deneyin! (tr) / 試す! (ja) / Testa! (sv) / Versuchen Sie es! (de-formal) / 試一試! (zh-hant) / Versuche es! (de) / Kokeile! (fi) / Δοκιμάστε το! (el) / Provu ĝin! (eo) / Zkuste to! (cs) / Isprobajte! (bs) / Provalo! (it) / এটি চেষ্টা করে দেখুন! (bn) / Essayez ! (fr) / پرشن کرو (pnb) / Паспрабуйце! (be-tarask) / de-at (1) / Виконати! (uk) / נסו את זה! (he) / SPARQL 쿼리 실행하기 (ko) / Biceribîne! (ku) / Probeer! (nl) / Experimenta! (pt) / ਪ੍ਰਸ਼ਨ ਕਰੋ (pa) / Izmēģini! (lv) / Prøv sjølv (nn) / Испробајте! (sr) / Cobalah! (id) / Пробајте! (mk) / Experimente! (pt-br) / جالنکن! (ms-arab) / ทดลองใช้ (th) / Wypróbuj! (pl) / Prøv selv! (nb) / 試試看! (zh-tw) / Jalankan! (ms) / Încercați! (ro) / Выполнить запрос (ru) / Provoje (sq) / Run it! (en) / تجربة! (ar) / 试一试! (zh-hans) / Оскалтэ! (udm)