|
28 | 28 | import java.awt.image.BufferedImage; |
29 | 29 | import java.io.ByteArrayOutputStream; |
30 | 30 | import java.io.File; |
| 31 | +import java.io.FileOutputStream; |
31 | 32 | import java.io.PrintStream; |
32 | 33 | import java.nio.charset.StandardCharsets; |
33 | 34 | import java.util.ArrayList; |
|
38 | 39 | import java.util.stream.Collectors; |
39 | 40 |
|
40 | 41 | import org.apache.poi.xslf.usermodel.XSLFPictureShape; |
41 | | -import org.apache.tinkerpop.gremlin.structure.io.IoCore; |
| 42 | +import org.apache.tinkerpop.gremlin.structure.io.Io; |
| 43 | +import org.apache.tinkerpop.gremlin.structure.io.graphml.GraphMLWriter; |
42 | 44 | import org.junit.FixMethodOrder; |
43 | 45 | import org.junit.Test; |
44 | 46 | import org.junit.runners.MethodSorters; |
|
48 | 50 | import com.bitplan.simplegraph.core.SimpleSystem; |
49 | 51 | import com.bitplan.simplegraph.mediawiki.MediaWikiPageNode; |
50 | 52 | import com.bitplan.simplegraph.mediawiki.MediaWikiSystem; |
51 | | -import com.bitplan.simplegraph.powerpoint.PowerPointSystem; |
52 | | -import com.bitplan.simplegraph.powerpoint.Slide; |
53 | | -import com.bitplan.simplegraph.powerpoint.SlideNode; |
54 | | -import com.bitplan.simplegraph.powerpoint.SlideShow; |
55 | | -import com.bitplan.simplegraph.powerpoint.SlideShowNode; |
56 | 53 | import com.bitplan.simplegraph.triplestore.TestTripleStoreSystem; |
57 | 54 | import com.bitplan.simplegraph.wikidata.TestWikiDataSystem; |
58 | 55 |
|
@@ -307,20 +304,24 @@ public void testPowerPointDoafterCreateAsGraph() throws Exception { |
307 | 304 | if (debug) |
308 | 305 | slides.forEach(slide -> slide.printNameValues(System.out)); |
309 | 306 | assertEquals(10, slides.size()); |
310 | | - pps.graph().io(IoCore.graphml()).writeGraph("../simplegraph-powerpoint/QueenVictoriaPowerPoint.xml"); |
| 307 | + // pps.graph().io(IoCore.graphml()).writeGraph("../simplegraph-powerpoint/QueenVictoriaPowerPoint.xml"); |
| 308 | + GraphMLWriter writer = GraphMLWriter.build().create(); |
| 309 | + try (FileOutputStream fos = new FileOutputStream("../simplegraph-powerpoint/QueenVictoriaPowerPoint.xml")) { |
| 310 | + writer.writeGraph(fos, pps.graph()); |
| 311 | + } |
311 | 312 | } |
312 | 313 |
|
313 | 314 | @Test |
314 | 315 | public void testReadPowerpoint() throws Exception { |
315 | 316 | PowerPointSystem pps=new PowerPointSystem(); |
316 | 317 | pps.connect(); |
317 | | - SimpleStepNode slideShowNode = (SimpleStepNode) pps.moveTo("http://www.its.leeds.ac.uk/fileadmin/documents/alumni/Michele_Dix_Leeds_University_-_FINAL.PPTX"); |
| 318 | + SimpleStepNode slideShowNode = (SimpleStepNode) pps.moveTo("https://github.com/WolfgangFahl/pySemanticSlides/raw/refs/heads/main/examples/semanticslides/SemanticSlides.pptx"); |
318 | 319 | List<SimpleStepNode> slides = slideShowNode.out("slides") |
319 | 320 | .collect(Collectors.toCollection(ArrayList::new)); |
320 | 321 | // debug=true; |
321 | 322 | if (debug) |
322 | 323 | slides.forEach(slide -> slide.printNameValues(System.out)); |
323 | | - long expected=44; |
| 324 | + long expected=3; |
324 | 325 | assertEquals(expected, slides.size()); |
325 | 326 | assertEquals(expected, pps.g().V().hasLabel("slide").count().next().longValue()); |
326 | 327 | assertEquals(expected, pps.g().V().hasLabel("slide").out("slideshow").count().next().longValue()); |
|
0 commit comments