# Semantic Publication of Agricultural Scientific Literature Using Property Graphs
## Appendix B Cypher Queries
Query 1: Cypher query to retrieve the number of nodes and edges in the knowledge graph  
MATCH (a) WITH count(a) as nodes MATCH ()-[r]->() WITH nodes, count(r) as edges RETURN nodes, edges  
Query 2: Cypher query to retrieve the number of authors per article, sorted by the number of authors  
MATCH (article:bibo_AcademicArticle) -[:bibo_authorList]-> (authorList:rdf_Seq) -> (author:foaf_Person) RETURN article.dct_title, count(author) as authors ORDER BY authors desc  
Query 3: Cypher query to retrieve the average number of authors per article  
MATCH (article:bibo_AcademicArticle) -[:bibo_authorList]-> (authorList:rdf_Seq) -> (author:foaf_Person) WITH article.dct_title astitle, count(author) as authors RETURN avg(authors)  
Query 4: Cypher query to retrieve the number of articles per author  
MATCH (author:foaf_Person) -[:foaf_publications]-> (article) RETURN author.foaf_name, count(article) as articles ORDER BY articles desc  
Query 5: Cypher query to retrieve the average number of articles per author  
MATCH (author:foaf_Person) -[:foaf_publications]-> (article) WITH author.foaf_name as authorName, count(article) as articles RETURN avg(articles)  
Query 6: Cypher query to retrieve the number of references per article, sorted by the number of references  
MATCH (article:bibo_AcademicArticle) -[:bibo_cites]-> (reference) RETURN article.dct_title, count(reference) as references ORDER BY references desc  
Query 7: Cypher query to retrieve the average number of references per article  
MATCH (article:bibo_AcademicArticle) -[:bibo_cites]-> (reference) WITH article.dct_title astitle, count(reference) as references REURN avg(references)
Query 8: Cypher query to retrieve how many times a reference is cited  
MATCH(reference)-[:bibo_citedBy]->(article:bibo_AcademicArticle)  
RETURN reference.uri as reference, count(article) asarticles  
ORDER BY articles desc  
Query 9: Cypher query to retrieve the average of how many times a reference is cited  
MATCH(reference) -[:bibo_citedBy]-> (article:bibo_AcademicArticle)  
WITH reference, count(article) asarticles  
RETURN avg(articles)  
Query 10: Cypher query to retrieve the number of the articles per journal  
MATCH(article:bibo_AcademicArticle) -[:dct_isPartOf]->  
(issue:bibo_Issue)-[:dct_isPartOf]->(journal:bibo_Journal)  
RETURN journal.dct_title, count(article) asarticles  
ORDER BY articles desc  
Query 11: Cypher query to retrieve the number of the articles per publisher  
MATCH(article:bibo_AcademicArticle)-[:dct_isPartOf]->  
(issue:bibo_Issue)-[:dct_isPartOf]->  
(journal:bibo_Journal)-[:dct_publisher]->  
(publisher:foaf_Organization)  
RETURN publisher.foaf_name, count(distinctarticle) asarticles  
ORDER BY articles desc  
Query 12: Cypher query to retrieve the number of the annotations in the data set  
MATCH(annotation:aot_ExactQualifier)  
WHERE annotation.aoc_body <> 'UNAVAILABLE'  
RETURN sum(annotation.biotea_tf)  
Query 13: Cypher query to retrieve the top ten most frequent annotations in the data set  
MATCH(annotation:aot_ExactQualifier) -[:aoc_annotatesResource]->  
(article:bibo_AcademicArticle)  
WHERE annotation.aoc_body <> 'UNAVAILABLE'  
RETURN annotation.aoc_body,  
sum(annotation.biotea_tf) as 'annotation count',  
count(article) asarticles  
ORDER BY 'annotation count' desclimit 10  
Query 14: Cypher query to retrieve the annotations that appear only once in the dataset  
MATCH(annotation:aot_ExactQualifier) -[:aoc_annotatesResource]->  
(article:bibo_AcademicArticle)  
WITH annotation.aoc_body astext,  
sum(annotation.biotea_tf) as 'annotation count',  
count(article) as 'article count'  
WHERE 'annotation count' = 1  
RETURN text, 'annotation count', 'article count'
Query 15: Cypher query to retrieve the number of the annotations that only appear once in the data set  
MATCH (annotation:aot__ExactQualifier)  
WITH annotation.aoc__body as text,  
sum(annotation.biotea__tf) as 'annotation count'  
WHERE 'annotation count' = 1  
RETURN count(text)  
Query 16: Cypher query to retrieve annotations, the number of classes that are supporting each annotation, and the average depth in which these classes are in the ontology hierarchy  
MATCH (topic:Class)<-[:aoc__hasTopic]-(annotation:aot__ExactQualifier)  
WHERE annotation.aoc__body in ['PLANTS', 'PLANT', 'STRESS', 'SOIL', 'RICE', 'EXPRESSION', 'GROWITH', 'OTHER', 'STUDY', 'GENES',  
'1-METHYLCYOLPROPENE', '1-PROPANOL', 'ABA RESPONSE',  
'ABSCISIC ACID METABOLISM', 'ACETYLATION', 'ACR2',  
'BOTANICAL GARDEN', 'BREAST ADENCCARNONMA', 'CHAPERONIN',  
'SESAME OIL']  
WITH topic, annotation  
MATCH (root:Class) where not (root)-[:subClassOf]->()  
WITH topic, root, annotation  
MATCH path = (topic)-[:subClassOf*]->(root)  
WITH length(path) as pathLength,  
topic,  
annotation  
WITH annotation.aoc__body as text,  
topic.uri as topicUri,  
min(pathLength) + 1 as depth  
RETURN text,  
count(topicUri) as annotatedClasses,  
avg(depth) as averageDepth  
Query 17: Cypher query to retrieve the number of ontology elements used in annotations per ontology, together with the total number of elements in the ontology and a percentage indicating the proportion of the elements used in annotations with respect to the total elements in each ontology.