SPARQL query service/queries/examples/en

From MiMoText
Jump to navigation Jump to search

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 "en". }
   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 per author

This query counts all novels per 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: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 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; # item is instance of literary work
        mmdt:P5 ?author; # item has author
        mmdt:P9 ?pubdate. # work has a publication date
  ?author rdfs:label ?authorName . # get author label
  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 with names containing “beau”

Get all authors with names containing “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 "en". }
}
Novels by François-Thomas-Marie de Baculard d’ARNAUD

Get all MiMoText 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

Handling of missing data statements concerning unknown narrative form

Example of handling missing data

#Handling of missing data statements
#title:Handling missing data

# 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 ?item ?itemLabel ?narrformLabel ?normalizedLabel WHERE {
  ?item mmdt:P2 mmd:Q2. 

  # Optional data fields for more details (some novels may not have these)
  OPTIONAL { ?item mmdt:P33 ?narrform. } # narrative form

  # Handling cases where narrpers is not available
  BIND(if(bound(?narrform), ?narrform, "unknown") as ?normalized)
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Handling missing data

Overview over the Graph

Count of authors, novels, thematic and spatial concepts as most important item classes

Overview over the numbers of the most important item types that is novels, authors, thematic concepts and spatial concepts.

#title:count of authors, novels, thematic concepts and spatial concepts
#Query to retrieve the count of authors, novels, thematic concepts and spatial concepts within the MiMoTextBase
prefix mmd:<http://data.mimotext.uni-trier.de/entity/>
prefix mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>
SELECT ?subject (COUNT(?o) as ?counts)
WHERE {
  VALUES (?p ?o) { (mmdt:P2 mmd:Q2) (mmdt:P11 mmd:Q11) (mmdt:P2 mmd:Q20) (mmdt:P2 mmd:Q26) }
  ?item ?p ?o.
  BIND(IF(?o = mmd:Q2, "novels", 
          IF(?o = mmd:Q11, "authors",
             IF(?o = mmd:Q20, "thematic concepts",
               IF(?o = mmd:Q26, "spatial concepts", "none")
           )
          )
         ) as ?subject)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}GROUP BY ?o ?subject
count of authors, novels, thematic concepts and spatial concepts

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 "en". }
    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

All novels and corresponding properties based on string statements extracted from bibliographic metadata

#title:Query to retrieve some data about the MiMoTextBase such as Authors, Novels, publicationyears, tonality etc. based on the string statements
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?bgrf ?item ?itemLabel ?authorLabel ?date ?narrpers ?tonality ?pages ?dist_format WHERE {
  ?item mmdt:P2 mmd:Q2. #item is instance of literary work
  OPTIONAL { ?item mmdt:P5 ?author} #item has author (optionally)
  OPTIONAL { ?item mmdt:P4 ?title} #item has title (optionally)
  OPTIONAL { ?item mmdt:P22 ?bgrf}  #item has identifier in the bibliographic metadata? (optionally)
  OPTIONAL { ?item mmdt:P23 ?date} #item has publication date (optionally)
  OPTIONAL { ?item mmdt:P27 ?narrpers} #item has narrative form (optionally)
  OPTIONAL { ?item mmdt:P31 ?tonality} #item has tonality (optionally)
  OPTIONAL { ?item mmdt:P25 ?pages} #item has page information (optionally)
  OPTIONAL { ?item mmdt:P26 ?dist_format} #item has distribution format (optionally)
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE], fr". }
} ORDER BY ?itemLabel
Query to retrieve some data about the MiMoTextBase such as Authors, Novels, publicationyears, tonality etc. based on the string statements

Overview over our controlled vocabulary

Get an overview of the controlled vocabularies created and used in the project.

#title:Overview over controlled vocabularies
# Query to retrieve the different controlled vocabularies
PREFIX mmd: <http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt: <http://data.mimotext.uni-trier.de/prop/direct/>

SELECT ?voc ?vocLabel (COUNT(?vocLabel) as ?count) (COUNT(?wikimatch) as ?wikimatch)
WHERE {
   ?item mmdt:P37 ?voc.
   ?voc mmdt:P2/mmdt:P1 mmd:Q17.
   OPTIONAL{
     values ?wiki {mmdt:P13 mmdt:P16}
     ?item ?wiki ?wikimatch}
   SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
  }
GROUP BY ?voc ?vocLabel
ORDER BY DESC(?count)
Overview over controlled vocabularies


Overview over the counts of how many authors have written how many literary works

Get an overview of how many authors have written how many literary works

#title: How many authors have written how many literary works?
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT  (count (?workcount) as ?authorcount) ?workcount
WHERE{
  SELECT ?authorName (count (?author) as ?workcount)
  WHERE {
    ?item mmdt:P2 mmd:Q2. # item is instance of literary work
     ?item mmdt:P5 ?author . # work has author.
     ?author rdfs:label ?authorName . # get author label
     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 (?workcount)
}
group by ?workcount
order by desc (?authorcount)
How many authors have written how many literary works?


How many literary works were written in the years 1751-1800 in average, in minimum and in maximum value?

Get an overview of how many works were written on average, in minimum and maximum per year

#title:How many literary works were written in the years 1751-1800 in average, in minimum and in maximum value?
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>
SELECT (AVG(?count) AS ?avg)
       (MIN(?count) AS ?min)
       (MAX(?count) AS ?max)
WHERE {
   SELECT DISTINCT (YEAR(?date) AS ?year) 
                   (COUNT(*) AS ?count)
   WHERE {
     ?item mmdt:P2 mmd:Q2.
     ?item mmdt:P9 ?date .
   }
   GROUP BY ?date
}
How many literary works were written in the years 1751-1800 in average, in minimum and in maximum value?

How many literary works were written per decades, query using if-statements

Get an overview of how many works were written per decade

#title:How many literary works were written per decades?
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>
SELECT ?decade (count(*) as ?count)
WHERE {
  SELECT DISTINCT ?item ?decade
  WHERE {
    ?item mmdt:P2 mmd:Q2. #item is instance of literary work
    ?item mmdt:P9 ?date . # item has a date of publication
    BIND(YEAR(?date) AS ?year)
    FILTER(?year >= 1750)
    BIND(
      IF(?year < 1760, "1750s",
      IF(?year < 1770, "1760s",
      IF(?year < 1780, "1770s",
      IF(?year < 1790, "1780s",
      IF(?year < 1800, "1790s",
      "1800")))))
      AS ?decade
    )
  }
  ORDER BY ?date
}
GROUP BY ?decade
How many literary works were written per decades?

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 "en".}
}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

Most similar literary works to Rousseau's works based on stylometric based similarity

Show the literary works that are closest to those written by Rousseau based on stylometric based similarity

#title:Most similar literary works to Rousseau's works based on stylometric based similarity
#defaultView:Tree
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/>

SELECT ?item ?itemLabel ?authorLabel ?data ?dataLabel ?author2Label ?val WHERE {
  ?item mmdt:P2 mmd:Q2;
        mmdt:P5 mmd:Q842;
        mmp:P49 ?data_stmt.
 ?data_stmt mmps:P49 ?data.  
  
  ?data_stmt mmpq:P52 ?val.
  ?data mmdt:P5 ?author2. 
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}       

ORDER By ?val
Most similar literary works to Rousseau's works based on stylometric based similarity

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 "en". }
   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 "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 "en" .}
  }

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 "en". }
}
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
#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(*) 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


Authors that wrote about sentimentalism (bubble chart)

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 (map)

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 (treemap)

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"

Themes occuring in novels of intention satire

#title:Themes occuring in novels of intention satire
#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 is instance of literary work
        mmdt:P39 mmd:Q3906; #novel has intention satire
        mmdt:P36 ?theme. #novel has theme
      ?theme rdfs:label ?themeLabel .
      FILTER (LANG(?themeLabel) = "en") .
}
GROUP BY ?theme
ORDER BY DESC(?count)
Themes occuring in novels of intention satire

Spaces

Places of publication over 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 "en" .}
}

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 "en". }
}
Authors in the MiMoTextBase with exact Wikidata match and Wikidata image

Get all language labels for "Voltaire" in Wikidata as a federated query

The entrypoint is the Item for Voltaire within the MiMotextBase. Get all labels availale in wikidata.

#title:Labels entered on wikidata-entry 'Voltaire'
PREFIX mmd:<http://data.mimotext.uni-trier.de/entity/>
PREFIX mmdt:<http://data.mimotext.uni-trier.de/prop/direct/>

SELECT (LANG(?VoltaireLabels) as ?lang) ?VoltaireLabels 
WHERE { 
  
  mmd:Q981 mmdt:P13 ?wikiDataEntity. # Voltaire has a wikidata match.

  #Federated Query -> Wikidata
  SERVICE <https://query.wikidata.org/sparql> {
  ?wikiDataEntity rdfs:label ?VoltaireLabels.
  }      	 
}
ORDER BY ?lang
Labels entered on wikidata-entry 'Voltaire'

MiMoTextBase novels with URL to the 'Bibliothèque nationale de France' and Wiki commons image

# MiMoText novels with URL to Bibliothèque nationale de France 
#defaultView:ImageGrid
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 ?item ?itemLabel ?wikidata ?bnfurl ?image 
WHERE {
  ?item mmdt:P2 mmd:Q2.
  ?item mmdt:P13 ?wikidata.
  ?item rdfs:label ?itemLabel .
  FILTER(lang(?itemLabel) = "en")
  SERVICE <https://query.wikidata.org/sparql> {
    ?wikidata wdt:P268 ?bnfid.
    OPTIONAL{ ?wikidata wdt:P18 ?image.}
   OPTIONAL{ wd:P268 wdt:P1630 ?formatterurl.}
   BIND(IRI(REPLACE(?bnfid, '^(.+)$', ?formatterurl)) AS ?bnfurl).
  }         
}
¡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)

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:Thematic statements derived from ‘topic modeling’ and the bibliography
#Statements on consistent topics in novels from both sources: Topic Modeling & bibliographic 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 DISTINCT ?novel ?novelLabel ?topicLabel ?BGRF_plot_theme WHERE
{   
    ?novel mmp:P36 ?statement.
    ?statement mmps:P36 ?topic.
    ?statement prov:wasDerivedFrom/mmpr:P18 ?tm. #reference statement uses 'P18'='stated in' topic modeling
    ?tm mmdt:P2 mmd:Q18.
    ?statement prov:wasDerivedFrom/mmpr:P18 mmd:Q1. #reference statement uses 'P18'='stated in' bibliographie  
    ?novel mmdt:P30 ?BGRF_plot_theme. #statement in the BGRF about the plot theme.
    SERVICE wikibase:label { bd:serviceParam wikibase:language "en". }
}
Thematic statements derived from ‘topic modeling’ and the bibliography

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 "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: Most similar literary works based on stylometric similarity distance

Shows the most similar works based on stylometric similarity distance as a Graph.

#title:Closest literary works based on stylometric similarity distance
#defaultView:Graph
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/>

SELECT ?item ?itemLabel ?minVal ?data ?dataLabel WHERE {
    ?item mmdt:P2 mmd:Q2; # item is instance of literary work
          mmp:P49 ?data_stmt. # statement on stylometric based distance
  ?data_stmt mmps:P49 ?data. # get the linked work
  ?data_stmt mmpq:P52 ?minVal. # get the work that has the closest distance from nested query
  
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
 
{SELECT ?item ?itemLabel (MIN(?val) AS ?minVal) # get the minimal value of all connected works
              WHERE {
  ?item mmdt:P2 mmd:Q2; # item is instance of literary work
        mmp:P49 ?data_stmt.  # statement on stylometric based distance
  ?data_stmt mmps:P49 ?data. # get the linked work
  ?data_stmt mmpq:P52 ?val. # get the distances for the works
  SERVICE wikibase:label { bd:serviceParam wikibase:language "[AUTO_LANGUAGE],en". }
}
GROUP BY ?item ?itemLabel
}
}
Closest literary works based on stylometric similarity distance

Graph and federation: 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 ?ref ?refLabel ?title 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
  ?ref mmdt:P4 ?title. 
  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)

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 "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 "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 "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 "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)