本文整理汇总了Python中rdflib.Graph.value方法的典型用法代码示例。如果您正苦于以下问题:Python Graph.value方法的具体用法?Python Graph.value怎么用?Python Graph.value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rdflib.Graph
的用法示例。
在下文中一共展示了Graph.value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: convert_graveyards
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def convert_graveyards(self, uri, graph: Graph):
"""
Convert graveyard information into URIs. Check if the created URI exists in cemeteries ontology.
"""
mun = graph.value(uri, SCHEMA_CAS.municipality_of_burial)
if not mun or str(mun) == 'X':
return graph
gy = graph.value(uri, SCHEMA_CAS.graveyard_number)
gy_uri = '{base}h{mun}'.format(base=CEMETERIES, mun=str(mun).split('/k')[-1])
# mun_uri = '{base}k{mun}'.format(base=KUNNAT, mun=mun)
if gy:
gy_uri += '_{gy}'.format(gy=gy)
else:
return graph
gy_uri = URIRef(GRAVEYARD_MAPPING.get(gy_uri, gy_uri))
if gy_uri not in self.cemeteries:
logging.info('Cemetery {gy} not found for person {p}'.format(gy=gy_uri, p=uri))
return graph
if str(gy).isnumeric():
graph.add((uri, SCHEMA_WARSA.buried_in, gy_uri))
graph.remove((uri, SCHEMA_CAS.graveyard_number, gy))
return graph
示例2: parse
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def parse(foaf_url):
global gexf_graph
global parsedFOAFS
global queuedFOAFS
g = Graph()
try:
g.load(foaf_url)
except Exception:
print "Can't fetch " + foaf_url
return
SIOC = Namespace("http://rdfs.org/sioc/ns#")
acctID = URIRef(g.value(URIRef(foaf_url), FOAF.maker) + "#acct")
root_accountName = str(g.value(acctID, FOAF.accountName))
root_webfinger = root_accountName + "@" + urlparse(foaf_url).hostname
subscriptions = prepareQuery(
"""SELECT ?accountName ?accountProfilePage
WHERE {
?person sioc:follows ?b .
?b foaf:accountName ?accountName .
?b foaf:accountProfilePage ?accountProfilePage .
}""",
initNs = { "foaf": FOAF, "sioc": SIOC })
subscribers = prepareQuery(
"""SELECT ?accountName ?accountProfilePage
WHERE {
?b sioc:follows ?person .
?b foaf:accountName ?accountName .
?b foaf:accountProfilePage ?accountProfilePage .
}""",
initNs = { "foaf": FOAF, "sioc": SIOC })
gexf_graph.addNode(root_webfinger, root_webfinger)
for subscription in g.query(subscriptions, initBindings={'person': acctID}):
accountProfilePage = str(subscription.accountProfilePage) + "/foaf"
accountName = str(subscription.accountName)
if (blacklisted(accountProfilePage) is False):
hostname = urlparse(accountProfilePage).hostname
webfinger = accountName + "@" + hostname
gexf_graph.addNode(webfinger, webfinger)
gexf_graph.addEdge(root_webfinger + webfinger, root_webfinger, webfinger)
if accountProfilePage not in parsedFOAFS:
queuedFOAFS.put(accountProfilePage)
for subscriber in g.query(subscribers, initBindings={'person': acctID}):
accountProfilePage = str(subscriber.accountProfilePage) + "/foaf"
accountName = str(subscriber.accountName)
if (blacklisted(accountProfilePage) is False):
hostname = urlparse(accountProfilePage).hostname
webfinger = accountName + "@" + hostname
gexf_graph.addNode(webfinger, webfinger)
gexf_graph.addEdge(webfinger + root_webfinger, root_webfinger, webfinger)
if accountProfilePage not in parsedFOAFS:
queuedFOAFS.put(accountProfilePage)
示例3: get_collection
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def get_collection(self):
"""Get collection level metadata of a branch
"""
# read standard files:
cfg_str = '\n'.join(self.repo.git_get_file_content(REPO_CONFIG_FILE,
self.branch))
std = Graph().parse(data=cfg_str, format="turtle")
col_node = std.value(predicate=RDF.type, object=DLNS.Collection)
col_name = std.value(subject=col_node, predicate=RDFS.label)
# additional turtle files in collection's basedir:
files = [file_ for file_ in self.repo.git_get_files(branch=self.branch)
if file_ == basename(file_) and file_ != REPO_CONFIG_FILE and
file_.endswith(".ttl")]
out = Graph(identifier=col_name) # avoid type 'URIRef' or sth.
for file_ in files:
file_str = '\n'.join(self.repo.git_get_file_content(file_,
self.branch))
out.parse(data=file_str, format="turtle")
# Note: By now we parse config.ttl and datalad.ttl two times here.
# The issue is to determine the identifier of hte graph, which can't be
# changed after creation. We probably also want to read certain files
# only into the returned graph later on.
return out
示例4: get_metadata
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def get_metadata(self, files=None):
"""
Gets metadata graph for the handle (all files in collection or just
`files`)
Parameters
----------
files: list of str
Returns
-------
rdflib.Graph
"""
cfg_str = '\n'.join(self.repo.git_get_file_content(self._cfg_file,
self.branch))
cfg_graph = Graph().parse(data=cfg_str, format="turtle")
h_node = cfg_graph.value(predicate=RDF.type, object=DLNS.Handle)
h_name = cfg_graph.value(subject=h_node, predicate=RDFS.label)
# additional files in handle's dir:
if files is None:
files = [file_
for file_ in self.repo.git_get_files(branch=self.branch)
if file_.startswith(self.repo._key2filename(self.key))
and basename(file_) != REPO_CONFIG_FILE]
out = Graph(identifier=h_name)
for file_ in files:
file_str = '\n'.join(self.repo.git_get_file_content(file_,
self.branch))
out.parse(data=file_str, format="turtle")
# Note: See note in CollectionRepoBackend.get_collection
return out
示例5: generate_event
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def generate_event(graph: Graph, casualty: URIRef, person: URIRef, event_type: URIRef, event_prefix: str,
date_prop: URIRef, place_prop: URIRef, relation_prop: URIRef, munics: Graph):
log.debug('Generating event {} {} {} {} {} {} {}'.format(casualty, person, event_type, event_prefix,
date_prop, place_prop, relation_prop))
event = Graph()
cas_local_id = get_local_id(casualty)
event_uri = URIRef('http://ldf.fi/warsa/events/{prefix}{id}'.format(prefix=event_prefix, id=cas_local_id))
event.add((event_uri, RDF.type, event_type))
event.add((event_uri, relation_prop, person))
event.add((event_uri, DCT.source, NARC_SOURCE))
if place_prop:
place = graph.value(subject=casualty, predicate=place_prop)
if place:
place_ws = munics.value(place, SCHEMA_CAS.preferred_municipality)
event.add((event_uri, CRM.P7_took_place_at, place_ws))
if date_prop:
date = graph.value(subject=casualty, predicate=date_prop)
if date:
timespan_uri = URIRef(
'http://ldf.fi/warsa/events/times/{prefix}{id}'.format(prefix=event_prefix, id=cas_local_id))
event.add((event_uri, CRM['P4_has_time-span'], timespan_uri))
# TODO: dateTimes
event.add((timespan_uri, CRM.P82a_begin_of_the_begin, date))
event.add((timespan_uri, CRM.P82b_end_of_the_end, date))
event.add((timespan_uri, SKOS.prefLabel, Literal(str(date))))
return event, event_uri
示例6: Test
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
class Test(unittest.TestCase):
def setUp(self):
self.g = Graph()
for rg in row_graphs_from_file(StringIO.StringIO(EXAMPLE)):
self.g += rg
self.csv = csv.DictReader(StringIO.StringIO(EXAMPLE))
def testCells(self):
#Count cells and make no one else has a fieldname
self.assertEquals(6, len(list(self.g[: RDF.type : CSV.Cell])))
for (cell, _) in self.g[ : CSV.fieldName :]:
self.assertEquals(CSV.Cell, self.g.value(cell, RDF.type))
#Check that all CSV cells are represented
for csv_row in self.csv:
for key, value in csv_row.items():
self.assertIn(Literal(int(value)),
self.g[Literal(key) : ~CSV.fieldName / CSV.fieldValue])
def testStructure(self):
#Count
self.assertEquals(1, len(list(self.g[: PROV.generated :])))
self.assertEquals(2, len(list(self.g[: PROV.generated / RDFS.member :])))
self.assertEquals(6, len(list(self.g[: PROV.generated / RDFS.member / RDFS.member :])))
#Types
for (imp, f) in self.g[: PROV.generated :]:
self.assertEquals(CSV.Import, self.g.value(imp, RDF.type))
self.assertEquals(CSV.File, self.g.value(f, RDF.type))
for row in self.g[f : RDFS.member]:
self.assertEquals(CSV.Row, self.g.value(row, RDF.type))
for cell in self.g[row : RDFS.member]:
self.assertEquals(CSV.Cell, self.g.value(cell, RDF.type))
示例7: prepareSellResponse
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def prepareSellResponse(urlSend):
g = Graph()
enviaments = Graph()
enviaments.parse(open('../data/enviaments'), format='turtle')
urlProducts = []
for item in enviaments.objects(subject=urlSend, predicate=ECSDI.Envia):
for product in enviaments.objects(subject=item, predicate=ECSDI.productos):
urlProducts.append(product)
products = Graph()
products.parse(open('../data/productes'), format='turtle')
for item in urlProducts:
marca = products.value(subject=item, predicate=ECSDI.Marca)
modelo = products.value(subject=item, predicate=ECSDI.Modelo)
nombre = products.value(subject=item, predicate=ECSDI.Nombre)
precio = products.value(subject=item, predicate=ECSDI.Precio)
g.add((item, RDF.type, ECSDI.Producto))
g.add((item, ECSDI.Marca, Literal(marca, datatype=XSD.string)))
g.add((item, ECSDI.Modelo, Literal(modelo, datatype=XSD.string)))
g.add((item, ECSDI.Precio, Literal(precio, datatype=XSD.float)))
g.add((item, ECSDI.Nombre, Literal(nombre, datatype=XSD.string)))
return g
示例8: extract_metadata
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def extract_metadata(self, rawhead, basefile):
metadata = util.readfile(self.store.downloaded_path(
basefile, attachment="index.rdf"))
# For some reason these RDF files might use canonical
# decomposition form (NFD) which is less optimal. Fix this.
metadata = unicodedata.normalize("NFC", metadata)
sourcegraph = Graph().parse(data=metadata)
rooturi = sourcegraph.value(predicate=RDF.type, object=BIBO.Book)
if rooturi is None:
# then just try to identify the main uri and use that
subjects = set(sourcegraph.subjects())
if len(subjects) == 1:
rooturi = next(iter(subjects))
title = sourcegraph.value(subject=rooturi, predicate=DC.title)
issued = sourcegraph.value(subject=rooturi, predicate=DC.date)
if isinstance(issued, str):
# sometimes dc:date is weird like "1976[1974]" (SOU 1974:42)
if len(issued) != 4:
self.log.warning("expected issued date as single 4-digit year, got %s" % issued)
# fall back on an approximation based on the basefile
issued = basefile.split(":")[0]
issued = Literal(util.gYear(int(issued)), datatype=XSD.gYear)
attribs = self.metadata_from_basefile(basefile)
attribs["dcterms:title"] = title
if issued:
attribs["dcterms:issued"] = issued
return attribs
示例9: test_CollectionRepo_add_handle
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def test_CollectionRepo_add_handle(annex_path, clone_path, clt_path):
# Note: for now just tests to add a HandleRepo instance.
# todo: different types!
handle = HandleRepo(clone_path, annex_path)
clt = CollectionRepo(clt_path)
clt.add_handle(handle, "first_handle")
ok_clean_git(clt_path, annex=False)
# test file layout:
ok_(os.path.exists(opj(clt.path, "first_handle")))
ok_(os.path.isdir(opj(clt.path, "first_handle")))
ok_(os.path.exists(opj(clt.path, "first_handle", REPO_STD_META_FILE)))
ok_(os.path.exists(opj(clt.path, "first_handle", REPO_CONFIG_FILE)))
# test statements:
# 1. within collection level metadata:
g_datalad = Graph().parse(opj(clt.path, REPO_STD_META_FILE),
format="turtle")
handle_uri = g_datalad.value(subject=DLNS.this, predicate=DCTERMS.hasPart)
assert_equal(handle_uri, URIRef(get_local_file_url(handle.path)))
# TODO: one says "file:///..." and the other just "/..."
# Note: Use datalad/utils.py:60:def get_local_file_url(fname)
# 2. handle's metadata:
g_config = Graph().parse(opj(clt.path, 'first_handle', REPO_CONFIG_FILE),
format="turtle")
assert_equal(g_config.value(subject=handle_uri, predicate=RDFS.label),
Literal('first_handle'))
assert_equal(g_config.value(subject=handle_uri,
predicate=DLNS.defaultTarget),
Literal('first_handle'))
示例10: test_dataset_description
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def test_dataset_description(self):
res1 = self.client.get(
'/', headers={'Accept': 'text/html'}, buffered=True)
self.assertEqual(res1.status_code, http.client.SEE_OTHER)
self.assertEqual(urlparse(res1.headers['Location']).path,
'/index.json.html')
res2 = self.client.get('/', headers={'Accept': 'text/turtle'})
self.assertEqual(res2.status_code, http.client.OK)
self.assertEqual(res2.headers['Content-Type'], 'text/turtle')
res3 = self.client.get('/.well-known/void')
self.assertEqual(res3.status_code, http.client.OK)
self.assertEqual(res3.headers['Content-Type'], 'text/turtle')
self.assertEqual(res3.get_data(as_text=True),
res2.get_data(as_text=True))
res4 = self.client.get('/.wellknown/void')
self.assertEqual(res4.status_code, http.client.OK)
self.assertEqual(res4.headers['Content-Type'], 'text/turtle')
self.assertEqual(res4.get_data(as_text=True),
res3.get_data(as_text=True))
res5 = self.client.get('/.well-known/void.ttl')
self.assertEqual(res5.status_code, http.client.OK)
self.assertEqual(res5.headers['Content-Type'], 'text/turtle')
self.assertEqual(res5.get_data(as_text=True),
res4.get_data(as_text=True))
res6 = self.client.get('/.well-known/void.ttl.html')
self.assertEqual(res6.status_code, http.client.OK)
self.assertEqual(res6.headers['Content-Type'], 'text/html')
g = Graph()
g.parse(format='turtle', data=res2.get_data(as_text=True))
self.assertIn(
(PERIODO['p0d'], DCTERMS.provenance, HOST['h#changes']), g)
desc = g.value(predicate=RDF.type, object=VOID.DatasetDescription)
self.assertEqual(
desc.n3(), '<http://n2t.net/ark:/99152/p0>')
title = g.value(subject=desc, predicate=DCTERMS.title)
self.assertEqual(
title.n3(), '"Description of the PeriodO Period Gazetteer"@en')
q = sparql.prepareQuery('''
SELECT ?count
WHERE {
?d void:classPartition ?p .
?p void:class ?class .
?p void:entities ?count .
}
''', initNs={'void': VOID, 'skos': SKOS})
concept_count = next(iter(g.query(
q, initBindings={'class': SKOS.Concept})))['count'].value
self.assertEqual(concept_count, 3)
scheme_count = next(iter(g.query(
q, initBindings={'class': SKOS.ConceptScheme})))['count'].value
self.assertEqual(scheme_count, 1)
示例11: EarthquakeRdfReader2
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
class EarthquakeRdfReader2():
def __init__(self, bindings = None):
"""
Initialize Graph and setup namespaces
@param bindings The path to a json configuration file.
"""
self.g = Graph()
self.setNamespaces(bindings)
def read(self, destination, format):
"""
Read RDF file and turn it into core concept objects
@param destination The destination of the file that contains the RDF data
@param format The input format. Supported formats: ‘xml’, ‘n3’, ‘turtle’, ‘nt’, ‘pretty-xml’, trix’
"""
self.g.parse(destination, format=format)
earthquakes = []
for subject, predicate, obj in self.g.triples( (None, RDF.type, self.eq.Earthquake) ):
earthquakes.append(self.parse(subject))
return earthquakes
def parse(self, subject):
"""
Create python Earthquake object for the passed RDF subject
@param subject The subject that needs to be turned into a python earthquake object
"""
properties = {
'latitude': self.g.value(subject, self.geo.lat),
'longitude': self.g.value(subject, self.geo.long),
'place': self.g.value(subject, self.lode.atPlace),
'atTime': self.g.value(subject, self.lode.atTime),
'mag': self.g.value(subject, self.qudt.vectorMagnitude),
}
return Earthquake(properties)
def setNamespaces(self, bindings):
"""
Sets up the namespaces
@param bindings The path to a json configuration file. The json file should have an array called "bindings".
Each object in this array should have an attribute called "prefix" for the prefix and an attribute called "namespace" for the namespace uri.
"""
json_data = open(bindings).read()
data = json.loads(json_data)
for obj in data['bindings']:
setattr(self, obj['prefix'], Namespace(obj['namespace']))
示例12: comunicacion
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def comunicacion():
"""
Entrypoint de comunicacion del agente
Simplementet retorna un objeto fijo que representa una
respuesta a una busqueda de hotel
Asumimos que se reciben siempre acciones que se refieren a lo que puede hacer
el agente (buscar con ciertas restricciones, reservar)
Las acciones se mandan siempre con un Request
Prodriamos resolver las busquedas usando una performativa de Query-ref
"""
global dsgraph
global mss_cnt
#Extraemos el mensaje y creamos un grafo con el
message= request.args['content']
gm = Graph()
gm.parse(data=message)
msgdic = get_message_properties(gm)
# Comprobamos que sea un mensaje FIPA ACL
if msgdic is None:
# Si no es, respondemos que no hemos entendido el mensaje
gr = build_message(Graph(), ACL['not-understood'], sender=InfoAgent.uri, msgcnt=mss_cnt)
else:
# Obtenemos la performativa
perf = msgdic['performative']
if perf != ACL.request:
# Si no es un request, respondemos que no hemos entendido el mensaje
gr = build_message(Graph(), ACL['not-understood'], sender=InfoAgent.uri, msgcnt=mss_cnt)
else:
#Extraemos el objeto del contenido que ha de ser una accion de la ontologia de acciones del agente
# de registro
# Averiguamos el tipo de la accion
if 'content' in msgdic:
content = msgdic['content']
accion = gm.value(subject=content, predicate= RDF.type)
# Aqui realizariamos lo que pide la accion
paq = paquet["vacances"]
actTypes = gm.value(subject= paq, predicate= paquet.act_types)
destination = gm.value(subject= paq, predicate= paquet.desti)
ga = buscar_activitats(destination, actTypes)
# Por ahora simplemente retornamos un Inform-done
gr = build_message(ga,
ACL['inform-done'],
sender=InfoAgent.uri,
msgcnt=mss_cnt,
receiver=msgdic['sender'],)
mss_cnt += 1
return gr.serialize(format='xml')
示例13: get
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def get(self):
out = []
if 1:
g = Graph()
g.parse("http://bang:9103/graph", format="n3")
tasks = [] # (pos, task)
for t in g.subjects(RDF.type, CV.OpenTask):
if (None, CV.child, t) in g:
continue
tasks.append((g.value(t, CV.position), t))
tasks.sort()
def appendTree(t, depth):
out.append(dict(
uri=t,
depth=depth,
mark=g.value(t, CV.mark),
content=g.value(t, CV.content),
))
for sub in g.objects(t, CV.child):
if (sub, RDF.type, CV.OpenTask) not in g:
continue
appendTree(sub, depth+1)
for pos, t in tasks[:10]:
appendTree(t, depth=0)
events = [] # [{'date':'yyyy-mm-dd', 'dayEvents':[], 'timeEvents':[]}]
g = Graph()
g.parse("http://bang:9105/events?days=3", format='n3')
byDay = {}
for ev in g.subjects(RDF.type, EV.Event):
start = g.value(ev, EV['start'])
s = parse(start)
d = s.date().isoformat()
byDay.setdefault(d, {'dayEvents':[],
'timeEvents':[]})[
'timeEvents' if 'T' in start else 'dayEvents'].append({
'title' : g.value(ev, EV['title']),
'start' : start,
'date' : s.date().isoformat(),
'time' : s.time().isoformat()[:-3],
})
for k,v in sorted(byDay.items(), key=lambda (k,v): k):
d = {'date':k, 'weekdayName':parse(k).strftime("%A")}
d.update(v)
d['dayEvents'].sort(key=lambda ev: ev['title'])
d['timeEvents'].sort(key=lambda ev: ev['start'])
events.append(d)
self.write(json.dumps({'tasks':out, 'events' : events}))
示例14: _license_desc
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def _license_desc( self, url):
permits_uri = URIRef("http://creativecommons.org/ns#permits")
requires_uri = URIRef("http://creativecommons.org/ns#requires")
prohibits_uri = URIRef("http://creativecommons.org/ns#prohibits")
comment_uri = URIRef(u'http://www.w3.org/2000/01/rdf-schema#comment')
ns_url = 'http://creativecommons.org/ns'
license_graph = Graph()
license_graph.parse(url)
ns_graph = Graph()
ns_graph.parse(ns_url)
lines = []
title = License.objects.get(url=url).title
desc = 'This is an Open Access article distributed under the terms of the Creative Commons %s License \
( %s),' % (title, url)
# get permits terms
for t in license_graph.subject_objects(permits_uri):
lines.append(ns_graph.value(subject=URIRef(t[1].replace('http:', 'https:')), predicate=comment_uri, object=None))
if lines:
lines = filter(None, lines)
desc += ' which permits %s, provided the original work is properly cited.' % (', '.join(lines))
# get requires terms
lines = []
for t in license_graph.subject_objects(requires_uri):
lines.append(ns_graph.value(subject=URIRef(t[1].replace('http:', 'https:')), predicate=comment_uri, object=None))
if lines:
lines = filter(None, lines)
desc += ' This license requires %s.' % (', '.join(lines))
# get prohibits terms
lines = []
for t in license_graph.subject_objects(prohibits_uri):
lines.append(ns_graph.value(subject=URIRef(t[1].replace('http:', 'https:')), predicate=comment_uri, object=None))
if lines:
lines = filter(None, lines)
desc += ' This license prohibits %s.' % (', '.join(lines))
#remove tabs, newlines and extra spaces
desc = re.sub('\t+|\n+', ' ', desc)
desc = re.sub(' +', ' ', desc)
logger.debug('LICENSE DESC: %s' % desc)
return desc
示例15: footer
# 需要导入模块: from rdflib import Graph [as 别名]
# 或者: from rdflib.Graph import value [as 别名]
def footer(self):
res = {}
for basefile in self.store.list_basefiles_for("generate"):
uri = self.canonical_uri(basefile)
g = Graph()
g.parse(self.store.distilled_path(basefile))
# only return those files that have olo:index metadata, in
# that order
if g.value(URIRef(uri), OLO['index']):
title = g.value(URIRef(uri), self.ns['dcterms'].title).toPython()
if not title:
title = basefile
res[int(g.value(URIRef(uri), OLO['index']))] = (title, uri)
return [res[x] for x in sorted(res)]