Mercurial > hg > graphML2RDF
changeset 5:e661aabed2f9
ressourceBase und Base ge?ndert.
author | dwinter |
---|---|
date | Mon, 30 Jul 2012 16:36:05 +0200 |
parents | 4fa7bf58e914 |
children | 6b51bd2418b9 |
files | graphML2RDF.py |
diffstat | 1 files changed, 8 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/graphML2RDF.py Mon Jul 23 09:58:50 2012 +0200 +++ b/graphML2RDF.py Mon Jul 30 16:36:05 2012 +0200 @@ -330,7 +330,8 @@ def exportAsRDF(self,filename,graphName,onlyMs=False,partOfGraph=None,linksToGraph=None): out = file(filename,"w") - base="http://example.org/harriotOnt/" + base="http://ontologies.mpiwg-berlin.mpg.de/reasearch/harriot.owl/1.0/" + ressourceBase="http://entities.mpiwg-berlin.mpg.de/reasearch/harriot.owl/1.0/" type2NodeShape={0: base+"Topic", 1: base+"Topic", 2: base+"Topic", @@ -361,7 +362,7 @@ if not label.lstrip().startswith("Add"): continue - ressourceURI=base+str(name) + ressourceURI=ressourceBase+str(name) try: s="" if label!="": @@ -391,7 +392,7 @@ tg=edge.target #tg=g.id2label.get(edge.target).replace("\n","").replace(" ","_").replace(".","_").replace("(","_").replace(")","_").replace("?","_").replace("'","_").replace(",","_").replace("-","_") - s ="""<%s><%s><%s>.\n"""%(base+str(sr),type2EdgeShape.get(edge.edgeType),base+str(tg)) + s ="""<%s><%s><%s>.\n"""%(ressourceBase+str(sr),type2EdgeShape.get(edge.edgeType),ressourceBase+str(tg)) #s = """%s -> %s [%s];\n"""%(sr,tg,type2EdgeShape.get(edge.edgeType)) out.write(s) except: @@ -404,8 +405,8 @@ fromNode=nodeID for graph in graphList: try: - ressourceURI=base+graph - s ="""<%s><%s><%s>.\n"""%(base+str(fromNode),base+"is_part_of",ressourceURI) + ressourceURI=ressourceBase+graph + s ="""<%s><%s><%s>.\n"""%(ressourceBase+str(fromNode),base+"is_part_of",ressourceURI) #s = """G_%s -> %s [color="yellow"];\n"""%(graph.replace(".","_"),fromNode) out.write(s) @@ -426,7 +427,7 @@ print graph gr = splitted[-1] print gr - ressourceURI=base+gr + ressourceURI=ressourceBase+gr @@ -437,7 +438,7 @@ relation="see_also" try: - s ="""<%s><%s><%s>.\n"""%(base+str(fromNode),relation,ressourceURI) + s ="""<%s><%s><%s>.\n"""%(ressourceBase+str(fromNode),relation,ressourceURI) #s = """%s -> G_%s [color="green"];\n"""%(fromNode,gr.replace(".","_")) out.write(s)