File: dctap2shex.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 (23 lines) | stat: -rw-r--r-- 537 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
from pyrudof import Rudof, RudofConfig, ShExFormatter

rudof = Rudof(RudofConfig())


dctap_str = """
shapeId,propertyId,Mandatory,Repeatable,valueDatatype,valueShape
Person,name,true,false,xsd:string,
,birthdate,false,false,xsd:date,
,enrolledIn,false,true,,Course
Course,name,true,false,xsd:string,
,student,false,true,,Person
"""

rudof.read_dctap_str(dctap_str)

dctap = rudof.get_dctap()

print(f"DCTAP\n{dctap}")

rudof.dctap2shex()
result = rudof.serialize_current_shex(ShExFormatter())
print(f"DCTAP converted to ShEx\n{result}")