File: service.py

package info (click to toggle)
rudof 0.1.146%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 10,048 kB
  • sloc: python: 1,288; makefile: 32; sh: 1
file content (14 lines) | stat: -rw-r--r-- 545 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
from pyrudof import Rudof, RudofConfig, RDFFormat, ReaderMode, ServiceDescriptionFormat

rudof = Rudof(RudofConfig())

service = "https://sparql.uniprot.org/sparql"

rudof.read_service_description_url(service, RDFFormat.Turtle, None, ReaderMode.Strict)
service = rudof.get_service_description()
service_str = service.serialize(ServiceDescriptionFormat.Json)
print(f"Service description in JSON:\n{service_str}")

# Converting service description to MIE
mie = service.as_mie()
print(f"Service description in MIE format as YAML:\n{mie.as_yaml()}")