# Semantic Publication of Agricultural Scientific Literature Using Property Graphs
## Appendix B Cypher Queries
MATCH (annotation:aot__ExactQualifier)-[:aoc__hasTopic]->(concept:Class)  
WHERE annotation.aoc__body <> 'UNAVAILABLE'  
WITH distinct concept.uri as concept  
WITH URIManager.getNamespace(concept) as ontologyPrefix,  
count(concept) as usedElements  
MATCH (element:Class)  
WHERE element.uri STARTS WITH ontologyPrefix  
WITH ontologyPrefix,  
usedElements,  
count (distinct element.uri) as totalElements  
RETURN ontologyPrefix,  
usedElements,  
totalElements,  
(100.0*usedElements)/totalElements as percentage  
ORDER BY totalElements desc  
**Query 18**: Cypher query to retrieve all articles annotated with polymers or any of its sub classes according PO2_DG ontology  
MATCH (polymerTopic:Class)<-[:subClassOf*]-(subTopics:Class)  
WHERE polymerTopic.uri ='[[http://opendata.inra.fr/PO2_DG/product/polymers](http://opendata.inra.fr/PO2_DG/product/polymers)]([http://opendata.inra.fr/PO2_DG/product/polymers](http://opendata.inra.fr/PO2_DG/product/polymers))'  
WITH COLLECT(polymerTopic) + COLLECT(subTopics) astopicList  
UNWND topicList astopics  
MATCH (article:bibo_AcademicArticle)<-  
[:aoc_annotatesResource]-  
(annotation:aot_ExactQualifier)-  
[:aoc_hasTopic]->(topics)  
RETURN article.dct_title, annotation.aoc_body  
Query 19**: Cypher query to compute the overlap similarity between each pair of articles according their common annotations  
MATCH (topic:Resource)<-[:aoc_hasTopic]-  
(annotation:aot_ExactQualifier)-[:aoc_annotatesResource]->  
(article:bibo_AcademicArticle)  
WHERE annotation.aoc_body <> 'UNAVAILABLE'  
WITH {item:id(article),  
categories:collect(distinct id(topic))} asuserData  
WITH collect(userData) as data  
CALL algo.similarity.overlap.stream(data)  
YIELD item1, item2, countl, count2, intersection, similarity  
RETURN algo.asNode(item1).dct_title AS from,  
algo.asNode(item2).dct_title AS to,  
count1, count2, intersection, similarity  
ORDER BY similarity DESC  
Query 20**: Cypher query to retrieve the paragraphs and the articles in which the annotation SIGMA FACTORS appears, and the other annotations within the paragraphs  
MATCH (annotation:aot_ExactQualifier{aoc_body:\"SIGMA FACTORS\"})  
-[:aoc_context]->(context:biotea_ElementSelector)  
-[:dct_references]->(paragraph:doco_Paragraph)  
WITH paragraph  
MATCH (otherAnnotations:aot_ExactQualifier)-[:aoc_context]->  
(context:biotea_ElementSelector)  
-[:dct_references]->(paragraph)-[:dct_isPartOf*]->  
(article:bibo_AcademicArticle)  
RETURN article.bibo_pmid aspmid,  
paragraph.dft_value asparagraph,  
collect(distinct otherAnnotations.aoc_body) asannotations  
Query 21**: Cypher query to retrieve the annotations that are always appearing together with SIGMA FACTORS in the same paragraph  
MATCH(annotation:aot_ExactQualifier{aoc_body:\"SIGMA FACTORS\"})  
-[:aoc_context]->(context:biotea_ElementSelector)  
-[:dct_references]->(paragraph:doco_Paragraph)  
MATCH (otherAnnotations:aot_ExactQualifier)-[:aoc_context]->(context:biotea__ElementSelector)-[:dct__references]-> (paragraph) WITHparagraph.rdf__valueasparagraphText, collect(distinctotherAnnotations.aoc__body)asannotationsPerParagraph WITHcollect(annotationsPerParagraph)asannotations WITHreduce(commonAnnotations=head(annotations), annotationintail(annotations)| apoc.coll.intersection(commonAnnotations,annotation))ascommonAnnotations RETURNcommonAnnotations Query 22: Cypher query to retrieve the annotations belonging to a concrete paragraph, together with the paragraph text MATCH (annotations:aot__ExactQualifier)-[:aoc__context]-> (context:biotea__ElementSelector)-[:dct__references]-> (paragraph:doco__Paragraph) WHEREparagraph.uri='[[http://purl.org/io/linkingdata/paragraph/pmcdoc_resource/6262949/](http://purl.org/io/linkingdata/paragraph/pmcdoc_resource/6262949/)]([http://purl.org/io/linkingdata/paragraph/pmcdoc_resource/6262949/](http://purl.org/io/linkingdata/paragraph/pmcdoc_resource/6262949/)) Methods_Statistical-analysis:para_2' REITURNparagraph.rdf__valueastext, COLLECT(annotations.aoc__body)asannotations