ORKG Papers

One of the main power points of the ORKG is the ability to represent scientific papers in a structured manner. The package also provide an endpoint to add new papers directly using the concepts defined on other components.

A paper technically is a collection of resources, literals, and statements connecting them in a small sub-graph.

Having defined our entry point to the ORKG instance

from orkg import ORKG # import base class from package

orkg = ORKG(host="<host-address-is-here>", creds=('email-address', 'password')) # create the connector to the ORKG

We can access the papers manager directly to do the following:

Adding new papers

The ORKG package can be used to create new papers in the ORKG instance you are connected to.

Note: if you have you credentials entered in the ORKG instance creation all newly added papers will be credited to your user.

# First define the paper content as dict (JSON object) (This is a sample of input)
paper = {
   "predicates":[

   ],
   "paper":{
      "title":"Open Research Knowledge Graph: Next Generation Infrastructure for Semantic Scholarly Knowledge",
      "doi":"10.1145/3360901.3364435",
      "authors":[
         {
            "label":"Mohamad Yaser Jaradeh"
         },
         {
            "label":"Allard Oelen"
         },
         {
            "label":"Kheir Eddine Farfar"
         },
         {
            "label":"Manuel Prinz"
         },
         {
            "label":"Jennifer D'Souza"
         },
         {
            "label":"Gábor Kismihók"
         },
         {
            "label":"Markus Stocker"
         },
         {
            "label":"Sören Auer"
         }
      ],
      "publicationMonth":"",
      "publicationYear":2019,
      "publishedIn":"Proceedings of the 10th International Conference on Knowledge Capture  - K-CAP '19",
      "researchField":"R11",
      "contributions":[
         {
            "name":"Contribution 1",
            "values":{
               "P32":[
                  {
                     "@temp":"_5254e420-ae9a-13ef-1c18-e716b9ea5c2b",
                     "label":"Similarity measures",
                     "class":"Problem",
                     "values":{

                     }
                  }
               ],
               "P3":[
                  {
                     "text":"Find similar research contributions inside the ORKG and suggest them to the user"
                  }
               ],
               "P1":[
                  {
                     "@temp":"_851da0a6-7e83-c276-8df3-f66d0a680b30",
                     "label":"TF/iDF",
                     "values":{
                        "P2":[
                           {
                              "text":"Term frequency, inverse document frequency technique"
                           }
                        ]
                     }
                  }
               ]
            }
         }
      ]
   }
}

# Then add the content as a paper to the ORKG instance
orkg.papers.add(params=paper)
>>> (Success)
{
   "id":"R8186",
   "label":"Open Research Knowledge Graph: Next Generation Infrastructure for Semantic Scholarly Knowledge",
   "created_at":"2019-12-19T15:07:02.136+01:00",
   "classes":[
      "Paper"
   ],
   "shared":0,
   "created_by":"00000000-0000-0000-0000-000000000000",
   "_class":"resource"
}

# you can append the contribution into the paper if it exists in the system by specifying the `merge_if_exists` property
orkg.papers.add(params=paper, merge_if_exists=True)
>>> (Success)
{
   "id":"R8186",
   "label":"Open Research Knowledge Graph: Next Generation Infrastructure for Semantic Scholarly Knowledge",
   "created_at":"2019-12-19T15:07:02.136+01:00",
   "classes":[
      "Paper"
   ],
   "shared":0,
   "created_by":"00000000-0000-0000-0000-000000000000",
   "_class":"resource"
}

Adding new papers via CSV

An easier way to import papers from a csv file containing the details is detailed in this Wiki page.

Warning

This functionality is deprecated as of version 0.16.3 and will be removed in a future update! You can still add papers by CSV import using the frontend.

Getting Paper id for providing paper doi

You can get paper/papers by providing paper doi

# Fetch a list of papers by doi
# You can also use the full doi link (e.g. https://doi.org/10.1108/ijpcc-06-2016-0030)
orkg.papers.by_doi(doi="10.1108/ijpcc-06-2016-0030")
>>> (Success)
[{
    "id": "R3000",
    "title": "A model for contextual data sharing in smartphone applications",
    "research_fields": [
        {
            "id": "R278",
            "label": "Information Science"
        }
    ],
    "identifiers": {
        "doi": "10.1108/ijpcc-06-2016-0030"
    },
    "publication_info": {
        "published_month": 9,
        "published_year": 2016,
        "published_in": "International Journal of Pervasive Computing and Communications",
        "url": null
    },
    "authors": [
        {
            "id": "R67818",
            "name": "Harshvardhan Pandit",
            "identifiers": {
                "orcid": "0000-0002-5068-3714"
            },
            "homepage": null
        },
        {
            "id": "R74265",
            "name": "Adrian O'Riordan",
            "identifiers": {
                "orcid": "0000-0002-5264-6044"
            },
            "homepage": null
        }
    ],
    "contributions": [
        {
            "id": "R3005",
            "label": "Contribution 1"
        }
    ],
    "observatories": [
        "00000000-0000-0000-0000-000000000000"
    ],
    "organizations": [
        "00000000-0000-0000-0000-000000000000"
    ],
    "extraction_method": "UNKNOWN",
    "created_at": "2019-01-06T15:04:07.692Z",
    "created_by": "00000000-0000-0000-0000-000000000000",
    "verified": true,
    "visibility": "DEFAULT"
}]

Getting Paper id for providing paper title

You can get paper/papers id by providing the title

# Fetch a list of papers by title
orkg.papers.by_title(title="A model for contextual data sharing in smartphone applications")
>>> (Success)
[{
    "id": "R3000",
    "title": "A model for contextual data sharing in smartphone applications",
    "research_fields": [
        {
            "id": "R278",
            "label": "Information Science"
        }
    ],
    "identifiers": {
        "doi": "10.1108/ijpcc-06-2016-0030"
    },
    "publication_info": {
        "published_month": 9,
        "published_year": 2016,
        "published_in": "International Journal of Pervasive Computing and Communications",
        "url": null
    },
    "authors": [
        {
            "id": "R67818",
            "name": "Harshvardhan Pandit",
            "identifiers": {
                "orcid": "0000-0002-5068-3714"
            },
            "homepage": null
        },
        {
            "id": "R74265",
            "name": "Adrian O'Riordan",
            "identifiers": {
                "orcid": "0000-0002-5264-6044"
            },
            "homepage": null
        }
    ],
    "contributions": [
        {
            "id": "R3005",
            "label": "Contribution 1"
        }
    ],
    "observatories": [
        "00000000-0000-0000-0000-000000000000"
    ],
    "organizations": [
        "00000000-0000-0000-0000-000000000000"
    ],
    "extraction_method": "UNKNOWN",
    "created_at": "2019-01-06T15:04:07.692Z",
    "created_by": "00000000-0000-0000-0000-000000000000",
    "verified": true,
    "visibility": "DEFAULT"
}]

Get papers by research field ID

You can get a list of papers from within a particular research field. You may optionally include papers from subfields as well. If the response is an empty list, it means the research field has no papers (or that the given ID does not correspond to a resource with the ‘ResearchField’ class label).

### Fetch papers by research field id
# research_field_id: the id of the research field
# include_subfields: True/False whether to include papers from subfields, default is False (optional)
# page: the page number (optional)
# size: number of items per page (optional)
# sort: key to sort on (optional)
# desc: true/false to sort desc (optional)
orkg.papers.in_research_field('R132', include_subfields=True, size=3)
>>> (Success)
[
   {
      'id': 'R339153',
      'label': 'Ontology-driven weak supervision for clinical entity classification in electronic health records',
      'classes': ['Paper']
   },
   {
      'id': 'R309164',
      'label': 'BN-DRISHTI: Bangla Document Recognition through Instance-level Segmentation of Handwritten Text Images',
      'classes': ['Paper']
  },
  {
      'id': 'R333086',
      'label': 'Management of Hyperglycemia in Type 2 Diabetes: A Patient-Centered Approach',
      'classes': ['Paper']
  }
]