Lab: Semantic Lifting - XML

From Info216
Revision as of 01:09, 19 March 2020 by Say004 (talk | contribs)

Lab 10: Semantic Lifting - XML

Link to Discord server


Today's topic involves lifting data in XML format into RDF. XML stands for Extensible Markup Language and is used to... The goal is for you to learn an example of how we can convert unsemantic data into RDF.

Relevant Libraries/Functions


If You have more Time

Code to Get Started

from rdflib import Graph, Literal, Namespace, URIRef
from rdflib.namespace import RDF, XSD
import xml.etree.ElementTree as ET
import requests
import re

g = Graph()
ex = Namespace("")
prov = Namespace("")
g.bind("ex", ex)
g.bind("ex", prov)

# url of rss feed
url = ''

# creating HTTP response object from given url
resp = requests.get(url)

# saving the xml file
with open('test.xml', 'wb') as f:

Useful Reading

XML-parsing-python by