{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import rdflib\n",
"from rdflib.plugins.sparql import prepareQuery\n",
"from tabulate import tabulate"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"filename = \"06_ABox.ttl\""
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"text1 = '''MS1_CQ_01\n",
"Provide a list of all articles authored by Yoyota Vuvuli over the last two years, ranked in a descending order by their citation counts.\n",
"'''\n",
"\n",
"query1 = '''\n",
"PREFIX tbox: <https://example.org/skg-if/extention/01/schema/>\n",
"PREFIX : <https://example.org/skg-if/extention/01/data/>\n",
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n",
"\n",
"SELECT DISTINCT\n",
"\n",
" ?title \n",
" (YEAR(?issued_date) AS ?year) \n",
" ?venue \n",
" ?doi\n",
" (GROUP_CONCAT(DISTINCT ?author; separator=\", \") AS ?authors)\n",
" (GROUP_CONCAT(DISTINCT ?affiliation; separator=\", \") AS ?affiliations)\n",
" ?multiple_contribution\n",
" ?topics\n",
" ?citations\n",
" ?downloads\n",
" ?reproducibility_badge\n",
" ?reproducibility_doi\n",
" ?reproducibility_score\n",
"\n",
"WHERE {\n",
"\n",
" ?article a tbox:ScholarlyWork ;\n",
" tbox:title ?title ;\n",
" tbox:hasIdentifier [\n",
" tbox:hasLiteralValue ?doi ;\n",
" tbox:usesIdentifierScheme tbox:doi \n",
" ] ;\n",
" tbox:realization [\n",
" tbox:issued ?issued_date ;\n",
" tbox:partOf [\n",
" tbox:title ?venue \n",
" ]\n",
" ] ;\n",
" tbox:isRelatedToRoleInTime [\n",
" tbox:withRole tbox:author ;\n",
" tbox:relatesToOrganization [\n",
" tbox:name ?affiliation \n",
" ] ;\n",
" tbox:isHeldBy [\n",
" tbox:name ?author \n",
" ] \n",
" ] ;\n",
" tbox:holdsBibliometricDataInTime [\n",
" tbox:withBibliometricData [\n",
" tbox:hasMeasure tbox:publication-citation-count ;\n",
" tbox:hasNumericValue ?citations \n",
" ]\n",
" ] ,\n",
" [\n",
" tbox:withBibliometricData [\n",
" tbox:hasMeasure tbox:publication-download-count ;\n",
" tbox:hasNumericValue ?downloads \n",
" ]\n",
" ] .\n",
"\n",
" {\n",
" SELECT DISTINCT\n",
" ?article\n",
" (GROUP_CONCAT(DISTINCT ?topic; separator=\", \") AS ?topics)\n",
" WHERE\n",
" {\n",
" ?article a tbox:ScholarlyWork ;\n",
" tbox:holdsBibliometricDataInTime [\n",
" tbox:withBibliometricData [\n",
" a tbox:SubjectTerm ;\n",
" tbox:prefLabel ?topic\n",
" ]\n",
" ]\n",
" }\n",
" GROUP BY ?article\n",
" }\n",
" \n",
" {\n",
" SELECT \n",
" ?article\n",
" (GROUP_CONCAT(DISTINCT ?full_contribution; separator=\"; \") AS ?multiple_contribution)\n",
" WHERE \n",
" {\n",
" {\n",
" SELECT DISTINCT\n",
" ?article\n",
" ?contributor\n",
" (GROUP_CONCAT(DISTINCT ?contribution_role; separator=\", \") AS ?contribution_roles)\n",
" \n",
" WHERE {\n",
" ?article a tbox:ScholarlyWork ;\n",
" tbox:isRelatedToRoleInTime [\n",
" tbox:withContribution [\n",
" tbox:prefLabel ?contribution_role\n",
" ] ;\n",
" tbox:isHeldBy [\n",
" tbox:name ?contributor \n",
" ] \n",
" ] .\n",
" }\n",
" GROUP BY ?contributor ?article\n",
" }\n",
"\n",
" BIND (CONCAT(?contributor, \": \", ?contribution_roles) AS ?full_contribution)\n",
" }\n",
" GROUP BY ?article\n",
" }\n",
"\n",
" OPTIONAL {\n",
" ?article tbox:holdsBibliometricDataInTime [\n",
" tbox:withBibliometricData [\n",
" a tbox:CategorialBibliometricData ;\n",
" tbox:prefLabel ?reproducibility_badge\n",
" ]\n",
" ] \n",
" }\n",
"\n",
" OPTIONAL {\n",
" ?article tbox:holdsBibliometricDataInTime [\n",
" tbox:withBibliometricData [\n",
" a tbox:CategorialBibliometricData ;\n",
" tbox:withinContext [\n",
" tbox:hasIdentifier [\n",
" tbox:hasLiteralValue ?reproducibility_doi ;\n",
" tbox:usesIdentifierScheme tbox:doi \n",
" ] \n",
" ]\n",
" ]\n",
" ] \n",
" }\n",
"\n",
" OPTIONAL {\n",
" ?article tbox:holdsBibliometricDataInTime [\n",
" tbox:withBibliometricData [\n",
" a tbox:CategorialBibliometricData ;\n",
" tbox:withinContext [\n",
" tbox:hasValue ?reproducibility_score\n",
" ]\n",
" ]\n",
" ] \n",
" }\n",
" \n",
"\n",
" FILTER (\n",
" ?issued_date >= \"2023-01-01T00:00:00+00:00\"^^xsd:dateTime \n",
" && \n",
" ?issued_date <= \"2024-12-31T23:59:59+00:00\"^^xsd:dateTime\n",
" )\n",
"}\n",
"GROUP BY ?article\n",
"ORDER BY DESC(?citations)\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"text2 = '''MS1_CQ_02\n",
"Provide all narratives included in John Doe's narrative CV.\n",
"'''\n",
"\n",
"query2 = '''\n",
"PREFIX tbox: <https://example.org/skg-if/extention/01/schema/>\n",
"PREFIX : <https://example.org/skg-if/extention/01/data/>\n",
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n",
"\n",
"SELECT DISTINCT ?narrative_title ?narrative_content\n",
"WHERE {\n",
" :john-doe tbox:submits [\n",
" tbox:hasPart [\n",
" tbox:title ?narrative_title ;\n",
" tbox:hasContent ?narrative_content \n",
" ]\n",
" ]\n",
"}\n",
"\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
"text3 = '''MS1_CQ_03\n",
"Provide information about the article-level indicator called \"Citations\".\n",
"'''\n",
"\n",
"query3 = '''\n",
"PREFIX tbox: <https://example.org/skg-if/extention/01/schema/>\n",
"PREFIX : <https://example.org/skg-if/extention/01/data/>\n",
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n",
"\n",
"SELECT DISTINCT ?intuition ?data_used ?methodology ?related_literature ?code\n",
"WHERE {\n",
" \n",
" ?article a tbox:ScholarlyWork ;\n",
" tbox:holdsBibliometricDataInTime [\n",
" tbox:withBibliometricData [\n",
" tbox:hasMeasure tbox:publication-citation-count \n",
" ] ;\n",
" tbox:description ?intuition ;\n",
" tbox:wasGeneratedBy [\n",
" tbox:used [\n",
" tbox:description ?data_used \n",
" ] ;\n",
" tbox:description ?methodology ;\n",
" tbox:wasAssociatedWith [\n",
" tbox:hasIdentifier [\n",
" tbox:hasLiteralValue ?code \n",
" ] \n",
" ] \n",
" ] \n",
" ] .\n",
"}\n",
"\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"text4 = '''MS1_CQ_04\n",
"Provide the values of all researcher-level indicators for Yoyota Vuvuli.\n",
"'''\n",
"\n",
"query4 = '''\n",
"PREFIX tbox: <https://example.org/skg-if/extention/01/schema/>\n",
"PREFIX : <https://example.org/skg-if/extention/01/data/>\n",
"PREFIX xsd: <http://www.w3.org/2001/XMLSchema#>\n",
"\n",
"SELECT DISTINCT ?measure ?value ?subject\n",
"WHERE {\n",
"\n",
" ?researcher tbox:name ?name ;\n",
" tbox:holdsBibliometricDataInTime ?bibliometric_data_in_time .\n",
" ?bibliometric_data_in_time tbox:withBibliometricData ?bibliometric_data .\n",
" ?bibliometric_data tbox:hasMeasure ?measure ;\n",
" tbox:hasNumericValue ?value .\n",
"\n",
" OPTIONAL {\n",
" ?bibliometric_data_in_time tbox:withinContext ?subject_term .\n",
" ?subject_term a tbox:SubjectTerm ;\n",
" tbox:prefLabel ?subject .\n",
" }\n",
"\n",
" FILTER (?name = \"Yoyota Vuvuli\")\n",
"}\n",
"\n",
"\n",
"'''"
]
},
{
"cell_type": "code",
"execution_count": 7,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"MS1_CQ_01\n",
"Provide a list of all articles authored by Yoyota Vuvuli over the last two years, ranked in a descending order by their citation counts.\n",
"\n",
"+---------------------------------------------------------------------+--------+--------------------------------------+-------------------------+-----------------------------------------------+-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+-------------+-------------+-------------------------+-----------------------+-------------------------+\n",
"| title | year | venue | doi | authors | affiliations | multiple_contribution | topics | citations | downloads | reproducibility_badge | reproducibility_doi | reproducibility_score |\n",
"|---------------------------------------------------------------------+--------+--------------------------------------+-------------------------+-----------------------------------------------+-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+-------------+-------------+-------------------------+-----------------------+-------------------------|\n",
"| Enhancing Sustainable Agriculture through AI-Driven Soil Monitoring | 2024 | Journal of Environmental Informatics | 10.1234/envinf.2022.001 | Yoyota Vuvuli, Ahmed El-Zein, Clara Green | University of Bologna | Yoyota Vuvuli: Conceptualization, Methodology, Writing (Lead); Ahmed El-Zein: Data Analysis, Software Development; Clara Green: Fieldwork, Writing (Review) | Machine Learning, Environmental Science, Precision Agriculture | 34 | 1200 | Data Open | 10.1234/agri2022data | |\n",
"| Towards a Comprehensive Ontology for Climate Data Sharing | 2023 | Data Science for Climate Change | 10.9101/dscc.2021.002 | Yoyota Vuvuli, Marie Dupont, Hiroshi Nakamura | University of Bologna | Yoyota Vuvuli: Conceptualization, Ontology Design, Writing (Lead); Marie Dupont: Data Integration, Writing (Review); Hiroshi Nakamura: Validation, Technical Infrastructure | Environmental Science, Biomedical Imaging | 18 | 950 | FAIR Data | | 85% |\n",
"+---------------------------------------------------------------------+--------+--------------------------------------+-------------------------+-----------------------------------------------+-----------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+----------------------------------------------------------------+-------------+-------------+-------------------------+-----------------------+-------------------------+\n",
"\n",
"\n",
"MS1_CQ_02\n",
"Provide all narratives included in John Doe's narrative CV.\n",
"\n",
"+-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n",
"| narrative_title | narrative_content |\n",
"|-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n",
"| Personal statement | I am a passionate and driven materials scientist dedicated to advancing sustainable solutions to global environmental challenges. My research focuses on the development of biodegradable polymers, aiming to reduce plastic waste and its impact on ecosystems. With over a decade of experience in academic and collaborative industry projects, I have cultivated a multidisciplinary approach, integrating chemistry, materials science, and environmental studies to drive innovation in sustainable materials. Throughout my career, I have been committed to fostering an inclusive and collaborative research environment. By mentoring early-career researchers, supervising diverse teams, and organizing training programs, I have supported others in achieving their potential while ensuring knowledge transfer across generations of scientists. Beyond my research contributions, I actively engage with the wider scientific and public communities to amplify the impact of my work. Whether through advising policymakers on sustainable packaging legislation or participating in outreach programs to inspire young minds, I strive to bridge the gap between science and society. |\n",
"| Contributions to General Knowledge | I have dedicated my career to advancing the understanding of sustainable materials science, focusing on the development of biodegradable polymers for packaging applications. My work has led to the publication of 25 peer-reviewed journal articles, including high-impact papers in Nature Materials and Advanced Functional Materials. I led the “Sustainable Polymers Initiative,” a collaborative research project funded by the European Research Council, which developed a novel polymer blend with 50% lower environmental impact compared to traditional plastics. This research has been widely cited and has attracted industrial interest, leading to a joint patent with GreenPack Ltd. Supervising a diverse group of PhD students and postdoctoral researchers, I have fostered innovation and collaboration, resulting in four students winning national awards for their research excellence. |\n",
"| Contributions to the Development of Individuals | I am deeply committed to mentoring and supporting the next generation of researchers. Over the past five years, I have served as a mentor for the Royal Society’s “Future Leaders Program,” guiding early-career scientists in grant writing, career development, and balancing academic and personal responsibilities. I have organized annual training workshops on advanced polymer synthesis techniques, attracting participants from academic and industrial backgrounds. These workshops have been instrumental in equipping attendees with practical skills and fostering industry-academia collaborations. Additionally, I co-developed an undergraduate internship program within my department, which has provided hands-on research opportunities to over 30 students, many of whom have progressed to postgraduate studies. |\n",
"| Contributions to Society | My research has directly contributed to addressing global environmental challenges. The biodegradable polymer developed in the Sustainable Polymers Initiative is now being scaled up by GreenPack Ltd., with the potential to replace traditional plastics in 20% of European food packaging markets by 2030. To raise public awareness, I have participated in science communication initiatives such as the BBC series Future Materials, explaining the role of sustainable materials in tackling climate change. I also contribute regularly to outreach programs in local schools, inspiring young students to pursue careers in STEM fields. In 2022, I collaborated with policymakers to draft recommendations for sustainable packaging legislation, which influenced the European Union’s “Green Materials Directive. |\n",
"+-------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+\n",
"\n",
"\n",
"MS1_CQ_03\n",
"Provide information about the article-level indicator called \"Citations\".\n",
"\n",
"+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------+----------------------------------------+\n",
"| intuition | data_used | methodology | related_literature | code |\n",
"|--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------+----------------------------------------|\n",
"| The total number of citations received by the article of interest. | Citations and article metadata required to calculate the particular indicator are gathered by the OpenAIRE Graph v9.0.0. | All citations from other articles pointing to the article of interest were counted. | | https://github.com/athenarc/Bip-Ranker |\n",
"+--------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------------+----------------------+----------------------------------------+\n",
"\n",
"\n",
"MS1_CQ_04\n",
"Provide the values of all researcher-level indicators for Yoyota Vuvuli.\n",
"\n",
"+-------------------------------------------------------------------------+---------+-----------------------+\n",
"| measure | value | subject |\n",
"|-------------------------------------------------------------------------+---------+-----------------------|\n",
"| https://example.org/skg-if/extention/01/schema/author-publication-count | 4 | |\n",
"| https://example.org/skg-if/extention/01/schema/author-publication-count | 2 | Environmental Science |\n",
"| https://example.org/skg-if/extention/01/schema/author-publication-count | 2 | Machine Learning |\n",
"| https://example.org/skg-if/extention/01/schema/author-citation-count | 124 | |\n",
"| https://example.org/skg-if/extention/01/schema/author-citation-count | 52 | Environmental Science |\n",
"| https://example.org/skg-if/extention/01/schema/author-citation-count | 106 | Machine Learning |\n",
"| https://example.org/skg-if/extention/01/schema/author-download-count | 5600 | |\n",
"+-------------------------------------------------------------------------+---------+-----------------------+\n",
"\n",
"\n"
]
}
],
"source": [
"queries = [(text1, query1),\n",
" (text2, query2),\n",
" (text3, query3),\n",
" (text4, query4)]\n",
"\n",
"g = rdflib.Dataset()\n",
"g.parse(filename, format=\"turtle\", encoding=\"utf-8\")\n",
"\n",
"for query in queries:\n",
" q = prepareQuery(query[1])\n",
" results = g.query(q)\n",
" print(query[0])\n",
" table = []\n",
" for row in results:\n",
" table.append([row[var] for var in results.vars])\n",
" print(tabulate(table, headers=results.vars, tablefmt=\"psql\"))\n",
" print(\"\\n\")"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}