template per yasgui

This commit is contained in:
cesare 2024-10-28 11:45:24 +01:00
parent 52f2c03e33
commit 4b35ba2ad5
1 changed files with 876 additions and 0 deletions

876
yasgui/index_its_lida.html Normal file
View File

@ -0,0 +1,876 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8"></meta>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/css/bootstrap4-toggle.min.css"/>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.13.1/themes/base/jquery-ui.css"/>
<link rel="stylesheet" id="style2-Boot" href="../css/bootstrap.min.lida2.css"/>
<link rel="stylesheet" id="style2-Custom" href="../css/custom2_4.3.css"/>
<link rel="stylesheet" href="../css/collapsemod.css" />
<link href="yasgui.mio.css" rel="stylesheet" type="text/css" />
<script src="https://code.jquery.com/jquery-3.6.0.js"></script>
<script
src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.1/dist/js/bootstrap.bundle.min.js"
integrity="sha384-fQybjgWLrvvRgtW6bFlB7jaZrFsaBXjsOMm/tB9LTS58ONXgqbR9W8oWht/amnpF"
crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.13.1/jquery-ui.js" defer></script>
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>
<script src="yasgui.min.js"></script>
<script type="text/javascript" src="../js/sparqltemplates.js"></script>
<script>
function writeQuery(query_s){
console.log(yasgui.getTab().yasqe)
yasgui.getTab().yasqe.setValue(query_s)
mw=document.getElementById("closeModalQ")
mw.click();
}
</script>
<script>
const defaultQuery=`PREFIX dc: <http://purl.org/dc/elements/1.1/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX ecrm: <https://erlangen-crm.org/current/>
SELECT * WHERE {
?sub ?pred ?obj .
} LIMIT 10`
const query_1=
`PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
# Versetti in cui compare la forma 'persecutio'.
SELECT ?rif (?vt as ?versetto)
WHERE {
FILTER regex(?tt,"^persecutio$","i") .
FILTER(LANGMATCHES(LANG(?titolo), "la"))
?lf ontolex:writtenRep ?tt ;
a ontolex:Form .
?sub a ontolex:LexicalEntry ;
ontolex:lexicalForm ?lf.
?subocc tresont:occurrenceOf ?sub ;
tresont:isPartOf ?vero .
?vero tresont:hasStructuralType tresont:Verse ;
tresont:hasNumber ?vno ;
tresont:occurrenceOf ?verso ;
tresont:isPartOf ?cha .
?verso ecrm:P190_has_symbolic_content ?vt.
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?chno ;
tresont:isPartOf ?boc.
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?bo ecrm:P102_has_title ?tilibro .
?tilibro rdfs:label ?titolo
BIND(concat(str(?titolo), ".", str(?chno), ".", str(?vno)) AS ?rif)
} order by ?sub limit 40`
const query_2=
`PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
# Versetti in cui compaiono parole che iniziano con la stringa 'perse'.
SELECT ?rif (?vt as ?versetto) (?tt as ?parola)
WHERE {
FILTER regex(?tt,"^perse","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?lf ontolex:writtenRep ?tt .
?sub a ontolex:LexicalEntry ;
ontolex:lexicalForm ?lf.
?subocc tresont:occurrenceOf ?sub ;
tresont:isPartOf ?vero ;
tresont:isPartOf ?cha.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:hasNumber ?vno;
tresont:occurrenceOf ?verso .
?verso ecrm:P190_has_symbolic_content ?vt.
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?chno;
tresont:isPartOf ?boc.
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?bo ecrm:P102_has_title ?tilibro .
?tilibro rdfs:label ?titolo .
BIND(concat(str(?titolo), ".", str(?chno), ".", str(?vno)) AS ?rif)
} order by ?libro ?cap ?ver limit 40`
const query_3=
`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
#Versetti che si ripetono piu di 8 volte
SELECT ?t_verso (GROUP_CONCAT(DISTINCT ?capitolo ;separator=", ")as ?libri) (count(?t_verso) as ?n)
WHERE {
?vero tresont:hasStructuralType tresont:Verse ;
tresont:isPartOf ?cha ;
tresont:occurrenceOf ?verso .
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:isPartOf ?boc.
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?bo ecrm:P102_has_title ?capitolo .
?verso ecrm:P190_has_symbolic_content ?t_verso.
} group by ?t_verso having (count(?t_verso) > 8) order by DESC(?n)`
const query_4=
`PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
#Cerco nel libro Chronicles le forme associate al lemma 'abeo'
SELECT ?rif ?tt ?lett ?vt
WHERE {
FILTER regex(?titolo,"^Genesis","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
FILTER regex(?tt,"^abeo$","i") .
?lcf a tresont:Lemma;
ontolex:writtenRep ?tt .
?lle a ontolex:LexicalEntry;
ontolex:lexicalForm ?lf ;
ontolex:canonicalForm ?lcf.
?lf ontolex:writtenRep ?lett .
?subocc tresont:occurrenceOf ?lle ;
tresont:isPartOf ?vero ;
tresont:isPartOf ?cha.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:hasNumber ?v_no;
tresont:occurrenceOf ?verso .
?verso ecrm:P190_has_symbolic_content ?vt.
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?ch_no;
tresont:isPartOf ?boc.
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?bo ecrm:P102_has_title ?libro .
?libro rdfs:label ?titolo .
BIND(concat(str(?libro), ".", str(?ch_no), ".", str(?v_no)) AS ?rif)
} order by ?ch_no ?v_no limit 40`
const query_5=`
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
#Cerco in tutti i libri le forme associate al lemma "abeo"
SELECT ?rif (?tt as ?lemma) (?lett as ?forma) ?vt
WHERE {
FILTER regex(?tt,"^abeo$","i") .
FILTER(LANGMATCHES(LANG(?titolo), "la"))
?lcf a tresont:Lemma;
ontolex:writtenRep ?tt .
?lle a ontolex:LexicalEntry;
ontolex:lexicalForm ?lf ;
ontolex:canonicalForm ?lcf.
?lf ontolex:writtenRep ?lett .
?subocc tresont:occurrenceOf ?lle ;
tresont:isPartOf ?vero ;
tresont:isPartOf ?cha.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:hasNumber ?v_no;
tresont:occurrenceOf ?verso .
?verso ecrm:P190_has_symbolic_content ?vt.
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?ch_no;
tresont:isPartOf ?boc.
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?bo ecrm:P102_has_title ?libro .
?libro rdfs:label ?titolo .
BIND(concat(str(?titolo), ".", str(?ch_no), ".", str(?v_no)) AS ?rif)
} order by ?libro ?ch_no ?v_no`
const query_6=`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
prefix lila: <http://lila-erc.eu/ontologies/lila/>
#Cerco 10 versetti del libro 'Chronicles' in cui la quarta parola abbia categoria grammaticale 'lila:verb'
SELECT ?rif (?tt as ?_lemma) (?lett as ?_parola) (?vt as ?_verso)
WHERE {
FILTER regex(?titolo,"^Genesis","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?libro rdfs:label ?titolo .
?bo ecrm:P102_has_title ?libro .
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:isPartOf ?boc;
tresont:hasNumber ?ch_no.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:hasNumber ?v_no;
tresont:isPartOf ?cha ;
tresont:inIntervalFrom ?iif ;
tresont:occurrenceOf ?verso .
?subocc tresont:isPartOf ?vero;
tresont:occurrenceOf ?sub ;
tresont:inIntervalFrom ?fiif .
?sub a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lcf;
ontolex:lexicalForm ?lf.
?lcf ontolex:writtenRep ?tt ;
lila:hasPOS lila:verb .
?lf ontolex:writtenRep ?lett .
?iif rdf:value ?vaiif .
FILTER(?vaiif+3 = ?fvaiif) .
?fiif rdf:value ?fvaiif .
?verso ecrm:P190_has_symbolic_content ?vt.
BIND(concat(str(?titolo), ".", str(?ch_no), ".", str(?v_no)) AS ?rif)
}limit 10`
const query_7=`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
#TEST termini con la stessa radice del lemma 'vita',
#basati sul valore della proprieta lila:hasBase del lemma (Da Verificare se adatta per coradicali/composti)
SELECT (?hb as ?_iribase) (?bsa as ?_lmsamebase)(?lett as ?forma) ?rif (?vt as ?_verso)
WHERE {
{
SELECT ?sa ?bsa ?lbsa ?posp ?tt ?hb
WHERE
{
FILTER regex(?tt,"^uita$","i") .
?lcf ontolex:writtenRep ?tt ;
lila:hasPOS ?posp ;
owl:sameAs ?sa.
SERVICE <https://lila-erc.eu/sparql/lila_knowledge_base/sparql> {
?sa lila:hasBase ?hb.
?lbsa lila:hasBase ?hb ;
rdfs:label ?bsa. }
}
}
?lemm a tresont:Lemma ;
ontolex:writtenRep ?mytt ;
owl:sameAs ?lbsa.
?sub a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lemm;
ontolex:lexicalForm ?lf.
?lf ontolex:writtenRep ?lett .
?subocc tresont:occurrenceOf ?sub ;
tresont:isPartOf ?vero.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:isPartOf ?cha ;
tresont:hasNumber ?vno;
tresont:occurrenceOf ?verso .
?verso ecrm:P190_has_symbolic_content ?vt.
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?chno;
tresont:isPartOf ?boc.
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?bo ecrm:P102_has_title ?libro .
FILTER(LANGMATCHES(LANG(?titolo),"en")).
?libro rdfs:label ?titolo .
BIND (CONCAT(str(?titolo), '.', str(?chno), '.', str(?vno)) as ?rif)
} order by ?rif limit 100`
const query_8=
`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
#Cerco i verbi presenti nel primo capitolo del libro 'Genesis', (uso i lemmi ottenuti da LiLa)
SELECT ?rif (?tt as ?lemma) (?labe as ?inflection) (?lett as ?parola) ?vt (?sa as ?lila_iri)
WHERE {
FILTER regex(?titolo,"^Genesis$","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
FILTER (?ch_no=1) .
?bo ecrm:P102_has_title ?libro .
?libro rdfs:label ?titolo.
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?ch_no;
tresont:isPartOf ?boc.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:isPartOf ?cha ;
tresont:occurrenceOf ?verso;
tresont:hasNumber ?v_no .
?verso ecrm:P190_has_symbolic_content ?vt.
?subocc tresont:occurrenceOf ?sub ;
tresont:inIntervalFrom ?fiif ;
tresont:isPartOf ?vero .
?sub a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lcf;
ontolex:lexicalForm ?lf.
?lf ontolex:writtenRep ?lett .
?lcf a tresont:Lemma ;
ontolex:writtenRep ?tt ;
lila:hasPOS lila:verb ;
owl:sameAs ?sa.
SERVICE <https://lila-erc.eu/sparql/lila_knowledge_base/sparql> {
?sa lila:hasInflectionType ?inty.
?inty rdfs:label ?labe .
}
BIND (CONCAT(str(?titolo), '.', str(?ch_no), '.', str(?v_no)) as ?rif)
} order by ?rif ?fiif`
const query_9=`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX lime: <http://www.w3.org/ns/lemon/lime#>
PREFIX skos: <http://www.w3.org/2004/02/skos#>
#Cerco i verbi presenti nel primo capitolo del libro 'Genesis' e per ciascun lemma visualizzo le definizioni nel dizionario Lewis & Short
SELECT ?rif (?lett as ?forma) (?tt as ?lemma) (GROUP_CONCAT(?definitionContent; separator='. ') as ?def) ?lexentry
WHERE {
FILTER regex(?title,"^Genesis$","i") .
FILTER (?ch_no=1) .
?bo ecrm:P102_has_title ?libro .
filter(langmatches(lang(?title), "en")).
?libro rdfs:label ?title .
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?ch_no;
tresont:isPartOf ?boc.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:isPartOf ?cha ;
tresont:hasNumber ?v_no .
?subocc tresont:occurrenceOf ?sub ;
tresont:isPartOf ?vero .
?sub a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lcf;
ontolex:lexicalForm ?lf.
?lf ontolex:writtenRep ?lett .
?lcf ontolex:writtenRep ?tt ;
lila:hasPOS lila:verb ;
owl:sameAs ?sa.
SERVICE <https://lila-erc.eu/sparql/lila_knowledge_base/sparql> {
<http://lila-erc.eu/data/lexicalResources/LewisShort/Lexicon> lime:entry ?lexentry .
?lexentry ontolex:canonicalForm ?sa ;
ontolex:sense ?definition .
?definition skos:definition ?definitionContent .
}
BIND(concat(str(?title), ".", str(?ch_no), ".", str(?v_no)) AS ?rif)
} group by ?rif ?tt ?lett ?lexentry order by ?rif limit 100`
const query_10=
`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
PREFIX lilals: <http://lila-erc.eu/data/lexicalResources/LewisShort/>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX lime: <http://www.w3.org/ns/lemon/lime#>
PREFIX skos: <http://www.w3.org/2004/02/skos#>
# TEST Cerco nei primi 10 versetti del capitolo 1 del libro 'Genesis' le parole che hanno
# la stringa 'life' nella definizione del dizionario Lewis & Short
SELECT distinct ?rif (?lett as ?parola) (?tt as ?lemma) (GROUP_CONCAT(?definitionContent; separator=". ") as ?def) ?lexentry
WHERE {
FILTER regex(?title,"^Genesis$","i") .
FILTER (?ch_no=1) .
?bo ecrm:P102_has_title ?libro .
filter(langmatches(lang(?title), "en")).
?libro rdfs:label ?title .
?boc tresont:occurrenceOf ?bo .
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?ch_no;
tresont:isPartOf ?boc.
FILTER (?v_no<11) .
?vero tresont:hasStructuralType tresont:Verse ;
tresont:isPartOf ?cha ;
tresont:hasNumber ?v_no .
?subocc tresont:isPartOf ?vero ;
tresont:occurrenceOf ?sub .
?sub a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lcf;
ontolex:lexicalForm ?lf.
?lcf owl:sameAs ?sa.
SERVICE <https://lila-erc.eu/sparql/lila_knowledge_base/sparql> {
?lexentry ontolex:canonicalForm ?sa ;
ontolex:sense ?definition .
lilals:Lexicon lime:entry ?lexentry .
FILTER regex(?definitionContent, "life", "i")
?definition skos:definition ?definitionContent .
}
?lcf ontolex:writtenRep ?tt .
?lf ontolex:writtenRep ?lett .
BIND(concat(str(?title),'.',str(?ch_no), ".", str(?v_no)) AS ?rif)
}group by ?rif ?lett ?tt ?lexentry`
const query_11=
`PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
#le 10 parole (con più di 4 lettere) più frequenti nel libro 'Exodus'
SELECT (?tt as ?parola) (count(?tt) as ?n_occorrenze)
WHERE {
FILTER regex(?titolo,"^Exodus$","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?bo ecrm:P102_has_title ?tilibro .
?tilibro rdfs:label ?titolo .
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?vero tresont:hasStructuralType tresont:Verse ;
tresont:isPartOf ?boc.
?subocc tresont:occurrenceOf ?sub ;
tresont:isPartOf ?vero.
?sub a ontolex:LexicalEntry ;
ontolex:lexicalForm ?lf.
?lf ontolex:writtenRep ?tt .
FILTER (STRLEN(?tt)> 4)
} group by ?tt having (count(?tt) > 30) order by DESC(?n_occorrenze) limit 10`
const query_12=
`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
#Le parole (> di 4 lettere) più frequenti nel libro Maccabees-1 che non compaiono nel libro Maccabees-2
SELECT (?tt as ?parola) (count(?tt) as ?n_occorrenze)
WHERE {
FILTER regex(?titolo,"^maccabees-1$","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?bo ecrm:P102_has_title ?libro .
?libro rdfs:label ?titolo .
?boc tresont:occurrenceOf ?bo .
?subocc tresont:isPartOf ?boc ;
tresont:occurrenceOf ?sub .
?sub ontolex:lexicalForm ?lf.
FILTER (STRLEN(?tt)> 4)
?lf ontolex:writtenRep ?tt .
minus{
FILTER regex(?titolo1,"^maccabees-2$","i") .
FILTER(LANGMATCHES(LANG(?titolo1), "en"))
?bo1 ecrm:P102_has_title ?libro1 .
?libro1 rdfs:label ?titolo1 .
?boc1 tresont:occurrenceOf ?bo1 .
?subocc1 tresont:isPartOf ?boc1 ;
tresont:occurrenceOf ?sub1 .
?sub1 ontolex:lexicalForm ?lf1.
FILTER (STRLEN(?tt)> 4)
?lf1 ontolex:writtenRep ?tt .
}
} group by ?tt having (count(?tt) > 20) order by DESC(?n_occorrenze) limit 10`
const query_13=
`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
prefix lila: <http://lila-erc.eu/ontologies/lila/>
PREFIX wfl: <http://lila-erc.eu/ontologies/lila/wfl/>
PREFIX lime: <http://www.w3.org/ns/lemon/lime#>
PREFIX lemonVartrans: <http://www.w3.org/ns/lemon/vartrans#>
#TEST cerca le forme derivate dal lemma "vita" secondo le regole definite dall'ontologia "Word Formation Latin" (WFL)
SELECT DISTINCT (?dtt as ?d_lemma) (?lett as ?forma) (?ruleLabel as ?_rule) ?ruleType ?rif (?vt as ?_verso)
WHERE {
{SELECT ?sa ?lemmaLabel ?mytt ?ruleLabel ?lemma2 ?ruleType
WHERE
{
FILTER regex(?tt,"^uita$","i") .
?lcf ontolex:writtenRep ?tt ;
owl:sameAs ?sa.
SERVICE <https://lila-erc.eu/sparql/lila_knowledge_base/sparql> {
?le ontolex:canonicalForm ?sa.
<http://lila-erc.eu/data/lexicalResources/WFL/Lexicon> lime:entry ?le .
?wflsourceRel lemonVartrans:source|lemonVartrans:target ?le;
wfl:hasWordFormationRule ?rule ;
lemonVartrans:target ?le2 ;
lemonVartrans:source ?le3 .
?le2 ontolex:canonicalForm ?lemma2 .
?le3 ontolex:canonicalForm ?lemma3 .
?le ontolex:canonicalForm ?lemma .
?rule rdfs:label ?ruleLabel;
rdf:type ?ruleType .
?lemma rdfs:label ?lemmaLabel.
?lemma2 rdfs:label ?mytt.
}
}
}
?lemm a tresont:Lemma ;
ontolex:writtenRep ?dtt ;
owl:sameAs ?lemma2 .
?sub a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lemm;
ontolex:lexicalForm ?lf.
?lf ontolex:writtenRep ?lett .
?subocc tresont:occurrenceOf ?sub ;
tresont:isPartOf ?vero.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:isPartOf ?cha ;
tresont:hasNumber ?vno;
tresont:occurrenceOf ?verso .
?verso ecrm:P190_has_symbolic_content ?vt.
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?chno;
tresont:isPartOf ?boc.
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?bo ecrm:P102_has_title ?libro .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?libro rdfs:label ?titolo .
BIND (CONCAT(str(?titolo), '.', str(?chno), '.', str(?vno)) as ?rif)
}order by ?rif limit 100`
const query_14=`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
#Cerco 10 versetti del libro 'Genesis' in cui compaiano due parole consecutive che hanno
#rispettivamente categoria 'lila:verb' e 'lila:noun'
SELECT ?rif (?tt as ?_lemma_v) (?lett as ?_verbo) (?tt1 as ?_lemma_n) (?lett1 as ?_nome)(?vt as ?_verso)
WHERE {
FILTER regex(?titolo,"^Genesis","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?libro rdfs:label ?titolo .
?bo ecrm:P102_has_title ?libro .
?boc tresont:occurrenceOf ?bo ;
tresont:hasStructuralType tresont:Book .
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:isPartOf ?boc;
tresont:hasNumber ?ch_no.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:hasNumber ?v_no;
tresont:isPartOf ?cha ;
tresont:occurrenceOf ?verso .
?subocc tresont:isPartOf ?vero;
tresont:occurrenceOf ?sub ;
tresont:inIntervalFrom ?fiif .
?sub a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lcf;
ontolex:lexicalForm ?lf.
?lcf lila:hasPOS lila:verb ;
ontolex:writtenRep ?tt .
?subocc1 tresont:isPartOf ?vero;
tresont:occurrenceOf ?sub1 ;
tresont:inIntervalFrom ?fiif1 .
?sub1 a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lcf1;
ontolex:lexicalForm ?lf1.
?lcf1 lila:hasPOS lila:noun ;
ontolex:writtenRep ?tt1 .
?fiif1 rdf:value ?fvaiif1 .
FILTER(?fvaiif1-1 = ?fvaiif) .
?fiif rdf:value ?fvaiif .
?lf1 ontolex:writtenRep ?lett1 .
?lf ontolex:writtenRep ?lett .
?verso ecrm:P190_has_symbolic_content ?vt.
BIND(concat(str(?titolo), ".", str(?ch_no), ".", str(?v_no)) AS ?rif)
} limit 20`
const query_15=
`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix ontolex: <http://www.w3.org/ns/lemon/ontolex#>
#Le parole (> di 4 lettere) più frequenti che compaiono in due libri
SELECT ?parola ?n_occorrenzeL1 ?n_occorrenzeL2
WHERE
{
{
SELECT (?tt as ?parola) (count(?tt) as ?n_occorrenzeL1)
WHERE {
FILTER regex(?titolo,"^maccabees-1$","i") .
FILTER(LANGMATCHES(LANG(?titolo), "en"))
?bo ecrm:P102_has_title ?libro .
?libro rdfs:label ?titolo .
?boc tresont:occurrenceOf ?bo .
?subocc tresont:isPartOf ?boc ;
tresont:occurrenceOf ?sub .
?sub ontolex:lexicalForm ?lf.
FILTER (STRLEN(?tt)> 3)
?lf ontolex:writtenRep ?tt .
} group by ?tt having (count(?tt) > 2) limit 40
}
{
SELECT (?tt as ?parola) (count(?tt) as ?n_occorrenzeL2)
WHERE {
FILTER regex(?titolo1,"^genesis$","i") .
FILTER(LANGMATCHES(LANG(?titolo1), "en"))
?bo1 ecrm:P102_has_title ?libro1 .
?libro1 rdfs:label ?titolo1 .
?boc1 tresont:occurrenceOf ?bo1 .
?subocc1 tresont:isPartOf ?boc1 ;
tresont:occurrenceOf ?sub1 .
?sub1 ontolex:lexicalForm ?lf1.
?lf1 ontolex:writtenRep ?tt .
} group by ?tt having (count(?tt) > 2) limit 40
}
}order by DESC(?n_occorrenzeL1) limit 20`
const query_16=`PREFIX ecrm: <https://erlangen-crm.org/current/>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX tresont: <https://itserr.it/ns/tresont/current/>
PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>
PREFIX ontolex: <http://www.w3.org/ns/lemon/ontolex#>
PREFIX lila: <http://lila-erc.eu/ontologies/lila/>
#TEST cerca le forme associate ai lemmi appartenenti allo stesso SynSet del lemma "vita"
#nella risorsa Latin WordNet pubblicata su LiLa
SELECT DISTINCT (?dtt as ?syn_lemma) ?base_label (?lett as ?parola) ?rif (?vt as ?_verso)
WHERE {
{SELECT ?lemma ?base ?syn ?sa ?dtt ?base_label
WHERE {
FILTER regex(?tt,"^uita$","i") .
?lcf ontolex:writtenRep ?tt ;
owl:sameAs ?sa.
SERVICE <https://lila-erc.eu/sparql/lila_knowledge_base/sparql> {
?le ontolex:canonicalForm ?sa ;
ontolex:evokes ?syn .
?le1 ontolex:canonicalForm ?lemma ;
ontolex:evokes ?syn .
?lemma rdfs:label ?dtt ;
lila:hasBase ?base .
?base rdfs:label ?base_label .
}
}
}
?lemm owl:sameAs ?lemma .
?sub a ontolex:LexicalEntry ;
ontolex:canonicalForm ?lemm;
ontolex:lexicalForm ?lf.
?lf ontolex:writtenRep ?lett .
?subocc tresont:occurrenceOf ?sub ;
tresont:isPartOf ?vero.
?vero tresont:hasStructuralType tresont:Verse ;
tresont:isPartOf ?cha ;
tresont:hasNumber ?vno;
tresont:occurrenceOf ?verso .
?verso ecrm:P190_has_symbolic_content ?vt.
?cha tresont:hasStructuralType tresont:Chapter ;
tresont:hasNumber ?chno;
tresont:isPartOf ?boc.
?boc tresont:occurrenceOf ?bo .
?bo ecrm:P102_has_title ?libro .
FILTER(LANGMATCHES(LANG(?titolo), "la"))
?libro rdfs:label ?titolo .
BIND (CONCAT(str(?titolo), '.', str(?chno), '.', str(?vno)) as ?rif)
} order by ?rif`
</script>
<style>
.yasgui .autocompleteWrapper {
display: none !important;
}
</style>
<title>ITSERR SPARQL Editor </title>
</head>
<body class="body-vis">
<div class="h-100 container-fluid">
<div>
<nav
class="navbar border navbar-expand-lg navbar-light bg-light justify-content-between fixed-top">
<button class="navbar-toggler" type="button" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1"
aria-controls="bs-example-navbar-collapse-1" aria-expanded="false"
aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<a class="navbar-brand font-weight-bold" href="#">ITSERR</a>
<div class="collapse navbar-collapse"
id="bs-example-navbar-collapse-1">
<ul class="navbar-nav">
<li class="nav-item"><a class="nav-link disabled" href="#">
- SPARQL query editor - </a></li>
</ul>
<ul class="navbar-nav">
<li class="nav-item">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#esempi_queries">
Esempi
</button>
</li>
</ul>
<ul class="navbar-nav ml-md-auto">
<li class="nav-item dropdown pt-1"><a
class="nav-link dropdown-toggle" href="#" id="navbarDropdown"
role="button" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false"> Info </a>
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
<a class="dropdown-item disabled" href="#" id="visAiuto">Aiuto</a>
<a class="dropdown-item" href="#" id="visAbout" data-toggle="modal" data-target="#aboutModal">About</a>
</div></li>
</ul>
</div>
</nav>
</div>
<!-- https://lida.dantenetwork.it/fuseki/itserr/query -->
<div id="rigaContenuti" class="row no-gutters">
<div class="d-table w-100 tableMain">
<div id="colVisualizza"
class="d-table-cell tableVis bg-lida-vis border-right border-bottom border-left align-top">
<div class="distanziatore">&nbsp;</div>
<div id="yasgui"></div>
<script>
const yasgui = new Yasgui(
document.getElementById("yasgui"),
{
yasqe : {
value: defaultQuery
},
requestConfig : {
endpoint : "https://lida.dantenetwork.it/fuseki/itserr/query"
},
copyEndpointOnNewTab : true,
resizeable : true,
});
const yasqe= yasgui.getTab().yasqe
const yasr= yasgui.getTab().yasr
//console.log(yasgui.config);
</script>
</div>
</div>
</div>
</div>
<div class="modal fade" id="esempi_queries" tabindex="-1" role="dialog" aria-labelledby="exampleModalLongTitle" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLongTitle">Esempi di query SPARQL</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Chiudi">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p><h5>Esempi di query sulla struttura</h5></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_1)'> Versetti in cui compare una forma.</a></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_2)'>Versetti in cui compaiono parole che iniziano con una stringa.</a></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_11)'>Le parole più frequenti in un libro.</a></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_3)'>Versetti che si ripetono più volte.</a></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_15)'>Le parole che compaiono in due libri, con il numero di occorrenze.</a></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_12)'>Le parole di un libro, che non compaiono in un altro libro.</a></p>
<p><h5>Esempi di query sul 'livello linguistico'</h5></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_4)'>Cerco in un libro le forme associate ad un lemma.</a></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_5)'>Cerco in tutta l'opera le forme associate ad un lemma.</a></p>
<p><a href="#" class="link-info" onClick='writeQuery(query_8)'>Cerco i verbi (lila:verb) presenti in un libro.</a></p>
<p><a href="#" class="link-danger" onClick='writeQuery(query_6)'>Cerco i versetti di un libro in cui una parola in una specifica posizione abbia categoria grammaticale 'lila:verb' (query distribuita sul dataset di LiLa).</a></p>
<p><a href="#" class="link-danger" onClick='writeQuery(query_14)'>Cerco i versetti di un libro in cui compaiano due parole consecutive che hanno rispettivamente categoria grammaticale 'lila:verb' e 'lila:noun'</a></p>
<p><a href="#" class="link-danger" onClick='writeQuery(query_13)'>Cerco le forme derivate da un lemma secondo le regole definite dall'ontologia "Word Formation Latin" (WFL)</a></p>
<p><a href="#" class="link-danger" onClick='writeQuery(query_7)'>Termini con la stessa radice basati sulla proprieta lila:hasBase del lemma cercato.</a></p>
<p><a href="#" class="link-danger" onClick='writeQuery(query_16)'>Cerca le forme associate ai lemmi appartenenti ad un SynSet della risorsa Latin WordNet pubblicata su LiLa</a></p>
<p><a href="#" class="link-danger" onClick='writeQuery(query_9)'>Cerco i verbi (lila:Verb) presenti in un libro e per ciascun lemma visualizzo la definizione nel dizionario Lewis &amp; Short.</a></p>
<p><a href="#" class="link-danger" onClick='writeQuery(query_10)'>Cerco in un capitolo di un libro le forme che hanno una particolare stringa nella definizione del dizionario Lewis & Short.</a></p>
</div>
<div class="modal-footer">
<button id="closeModalQ" type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
<!-- <button type="button" class="btn btn-primary">Save changes</button> -->
</div>
</div>
</div>
</div>
<div class="modal fade" id="aboutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">About</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<p>SPARQL editor per il grafo RDF della Vulgata, realizzato per il gruppo di lavoro del WP8 del progetto ITSERR.</p> <p>Realizzato da Cesare Concordia e Carlo Meghini, ISTI-CNR.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- <div id="yasgui"></div> -->
</body>
</html>