def createDemo(): """Create and return a new FenPDF object using the demo space. Creates a nonexistent file and a new pool in tmp/. """ # XXX NOT PORTABLE os.system("mkdir -p tmp/; rm -rf tmp/pool tmp/test.rdf; mkdir -p tmp/pool") POOLDIR = "tmp/pool" FILE = "tmp/test.rdf" pool = storm.impl.DirPool(java.io.File(POOLDIR), java.util.HashSet()) myalph = alph.impl.StormAlph(pool) fen = ff.Fen() fen.alph = myalph fen.constgraph = fen.graph = ff.swamp.impl.HashGraph() # Create the enfilade/nodecontent structure structure_ff = ff.structure.Ff.create(fen.graph, fen.alph) treetime = ff.structure.TreeTime(TREETIME.follows) fen.enfiladeOverlap = structure_ff.getTransclusionIndex() ff.fenpdf.demospace.createDemoSpace(fen, myalph, treetime, structure_ff) fenPDF = ff.fenpdf.fenpdf.FenPDF(fen, treetime, structure_ff, ff.test.gfx.win, FILE) return fenPDF
def newFen(graph = None): pool = storm.impl.TransientPool(java.util.HashSet()) myalph = alph.impl.StormAlph(pool) fen = ff.Fen() if graph == None: graph = ff.swamp.impl.HashGraph() fen.graph = fen.constgraph = graph ff_structure = ff.structure.Ff.create(fen.graph, myalph); fen.enfiladeOverlap = ff_structure.getTransclusionIndex() return (fen, ff_structure, ff.structure.Ff.ContentFunction(ff_structure))
# storm pool directory and mindmap file DIR = 'myFenfire/' FILE = java.lang.System.getProperty("fenmm.file", DIR + "mindmap.rdf") POOLDIR = java.lang.System.getProperty("fenmm.pool", DIR) try: FILE = argv[1] except IndexError: pass os.system('mkdir -p ' + POOLDIR) pool = storm.impl.DirPool(java.io.File(POOLDIR), java.util.HashSet()) myalph = alph.impl.StormAlph(pool) fen = ff.Fen() if os.path.isfile(FILE): print 'Loading the RDF graph from the file %s.' % (FILE) m = ModelMem() m.read(java.io.FileReader(FILE), None) fen.constgraph = fen.graph = ff.swamp.Graphs.toGraph(m) else: print 'Creating a new RDF graph.' fen.graph = fen.constgraph = ff.swamp.impl.HashGraph() fen.txt = ff.impl.SimpleNodeContent(fen, myalph) fen.txtfunc = fen.txt.getNodeFunction() fen.enfiladeOverlap = fen.txt.getTransclusionIndex() ## Not used now