Skip to content

Commit

Permalink
fixes #5 (module existence) fixes #8 (workaround)
Browse files Browse the repository at this point in the history
  • Loading branch information
WolfgangFahl committed Mar 13, 2018
1 parent f628e9f commit c65aff2
Show file tree
Hide file tree
Showing 17 changed files with 270 additions and 18 deletions.
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -10,6 +10,7 @@ Allows Wrapping Systems to make them available for Graph processing with [Apache
|---------------------------------------------------------------------- | ---------------- | ----------- |
|![Excel](https://upload.wikimedia.org/wikipedia/commons/thumb/8/86/Microsoft_Excel_2013_logo.svg/100px-Microsoft_Excel_2013_logo.svg.png)[Excel](http://www.bitplan.com/index.php/SimpleGraph-Excel) |[Excel](https://en.wikipedia.org/wiki/Microsoft_Excel) |[Apache POI XSSF/HSSF](https://poi.apache.org/spreadsheet/quick-guide.html)
|![FileSystem](https://upload.wikimedia.org/wikipedia/commons/thumb/f/f3/Folder.svg/100px-Folder.svg.png)[FileSystem](http://www.bitplan.com/index.php/SimpleGraph-FileSystem) |[FileSystem](https://en.wikipedia.org/wiki/File_system) |[java.io.File](https://docs.oracle.com/javase/8/docs/api/java/io/File.html)
|![GitHub](http://wiki.bitplan.com/images/wiki/6/61/Octocat.png)[GitHub](http://www.bitplan.com/index.php/SimpleGraph-GitHub) |[GitHub](https://github.com) |[GitHub GraphQL API v4](https://developer.github.com/v4/)
|![HTML](https://upload.wikimedia.org/wikipedia/commons/thumb/6/61/HTML5_logo_and_wordmark.svg/100px-HTML5_logo_and_wordmark.svg.png)[HTML](http://www.bitplan.com/index.php/SimpleGraph-HTML) |[HTML](https://en.wikipedia.org/wiki/HTML) |[HTML Cleaner](http://htmlcleaner.sourceforge.net/)
|![Java](http://wiki.bitplan.com/images/wiki/e/e1/Java-Logo.svg)[Java](http://www.bitplan.com/index.php/SimpleGraph-Java) |[Java](https://en.wikipedia.org/wiki/Java_(programming_language)) |[javaparser](https://github.com/javaparser/javaparser)
|![JSON](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c9/JSON_vector_logo.svg/100px-JSON_vector_logo.svg.png)[JSON](http://www.bitplan.com/index.php/SimpleGraph-JSON) |[JSON](https://en.wikipedia.org/wiki/JavaScript_Object_Notation) |[JSON](https://www.json.org/)
Expand Down Expand Up @@ -41,3 +42,4 @@ Allows Wrapping Systems to make them available for Graph processing with [Apache
* 2018-01-15 adds WikiData access
* 2018-02-19 adds Excel,HTML,JSON,MapSystem,MediaWiki,PDF,SMW,SQL and Word
* 2018-03-04 adds SNMP, Java and XML
* 2018-03-09 adds GitHub
2 changes: 1 addition & 1 deletion createModule
Expand Up @@ -96,7 +96,7 @@ EOF
#
# loop over all modules
#
for module in bundle core excel filesystem html java json mail map mediawiki pdf powerpoint snmp sql smw triplestore wikidata word xml
for module in bundle core excel filesystem github html java json mail map mediawiki pdf powerpoint snmp sql smw triplestore wikidata word xml
do
moduleName=simplegraph-$module
package=com.bitplan.$module
Expand Down
3 changes: 3 additions & 0 deletions pom.xml
Expand Up @@ -35,12 +35,15 @@
<gson.version>2.8.2</gson.version>
<!-- https://mvnrepository.com/artifact/com.github.javaparser/javaparser-symbol-solver-core -->
<javaparser.version>3.5.15</javaparser.version>
<!-- https://mvnrepository.com/artifact/com.graphql-java/graphql-java -->
<graphql.version>7.0</graphql.version>
</properties>
<packaging>pom</packaging>
<url>https://github.com/BITPlan/com.bitplan.simplegraph</url>
<modules>
<module>simplegraph-core</module>
<module>simplegraph-filesystem</module>
<module>simplegraph-github</module>
<module>simplegraph-html</module>
<module>simplegraph-java</module>
<module>simplegraph-json</module>
Expand Down
12 changes: 12 additions & 0 deletions simplegraph-bundle/pom.xml
Expand Up @@ -49,6 +49,18 @@
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>com.bitplan.simplegraph.github</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>com.bitplan.simplegraph.github</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>com.bitplan.simplegraph.html</artifactId>
Expand Down
Expand Up @@ -26,6 +26,7 @@
import com.bitplan.simplegraph.core.TestTinkerPop3;
import com.bitplan.simplegraph.excel.TestExcelSystem;
import com.bitplan.simplegraph.filesystem.TestFileSystem;
import com.bitplan.simplegraph.github.TestGitHubSystem;
import com.bitplan.simplegraph.java.TestJavaSystem;
import com.bitplan.simplegraph.json.TestJsonSystem;
import com.bitplan.simplegraph.map.TestMapSystem;
Expand All @@ -41,7 +42,7 @@
import com.bitplan.simplegraph.xml.TestXmlSystem;

@RunWith(Suite.class)
@Suite.SuiteClasses({ TestExcelSystem.class, TestFileSystem.class,
@Suite.SuiteClasses({ TestExcelSystem.class, TestFileSystem.class,TestGitHubSystem.class,
TestJavaSystem.class, TestJsonSystem.class, TestTinkerPop3.class,
TestTripleStoreSystem.class, TestPowerPointSystem.class,
TestMediaWikiSystem.class, TestMapSystem.class, TestPdfSystem.class,
Expand Down
26 changes: 26 additions & 0 deletions simplegraph-github/.classpath
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="target/classes"/>
</classpath>
23 changes: 23 additions & 0 deletions simplegraph-github/.project
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>simplegraph-github</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.m2e.core.maven2Builder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.m2e.core.maven2Nature</nature>
</natures>
</projectDescription>
28 changes: 28 additions & 0 deletions simplegraph-github/pom.xml
@@ -0,0 +1,28 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<name>SimpleGraph GitHub</name>
<description>com.bitplan.simplegraph.github submodule of com.bitplan.simplegraph</description>

<parent>
<groupId>com.bitplan.simplegraph</groupId>
<artifactId>com.bitplan.simplegraph</artifactId>
<version>0.0.2</version>
</parent>
<artifactId>com.bitplan.simplegraph.github</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>com.bitplan.simplegraph-core</artifactId>
<version>${project.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.graphql-java/graphql-java -->
<dependency>
<groupId>com.graphql-java</groupId>
<artifactId>graphql-java</artifactId>
<version>${graphql.version}</version>
</dependency>
</dependencies>
</project>
@@ -0,0 +1,56 @@
/**
* Copyright (c) 2018 BITPlan GmbH
*
* http://www.bitplan.com
*
* This file is part of the Opensource project at:
* https://github.com/BITPlan/com.bitplan.simplegraph
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bitplan.simplegraph.github;


import com.bitplan.simplegraph.core.SimpleNode;
import com.bitplan.simplegraph.core.SimpleSystem;
import com.bitplan.simplegraph.impl.SimpleSystemImpl;

/**
* wraps the GitHub access via the GitHub Java API
* http://github-api.kohsuke.org/
* @author wf
*
*/
public class GitHubSystem extends SimpleSystemImpl {


@Override
public SimpleSystem connect(String... connectionParams) throws Exception {

return this;
}

@Override
public SimpleNode moveTo(String nodeQuery, String... keys) {
// TODO Auto-generated method stub
return null;
}

@Override
public Class<? extends SimpleNode> getNodeClass() {
// TODO Auto-generated method stub
return null;
}


}
@@ -0,0 +1,57 @@
/**
* Copyright (c) 2018 BITPlan GmbH
*
* http://www.bitplan.com
*
* This file is part of the Opensource project at:
* https://github.com/BITPlan/com.bitplan.simplegraph
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.bitplan.simplegraph.github;

import java.util.logging.Logger;

import org.junit.Test;

import com.bitplan.simplegraph.core.SimpleNode;

/**
* test the GitHub System
*
* @author wf
*
*/
public class TestGitHubSystem {
public static boolean debug = false;
protected static Logger LOGGER = Logger
.getLogger("com.bitplan.simplegraph.github");

@Test
public void testGitHubSystem() throws Exception {
GitHubSystem ghs = new GitHubSystem();
ghs.connect();
ghs.moveTo("");
ghs.forAll(SimpleNode.printDebug);
}

@Test
public void testGitHubGraphQLApi() {
// https://developer.github.com/v4/explorer/
// https://developer.github.com/v4/guides/forming-calls/#the-graphql-endpoint
// https://api.github.com/graphql
// https://stackoverflow.com/questions/tagged/graphql-java
}


}
Binary file modified simplegraph-powerpoint/QueenVictoria.pptx
Binary file not shown.
2 changes: 1 addition & 1 deletion simplegraph-powerpoint/QueenVictoriaWikiDataItems.xml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion simplegraph-powerpoint/QueenVictoriaWikiDataProperties.xml

Large diffs are not rendered by default.

Expand Up @@ -24,6 +24,9 @@
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
Expand All @@ -47,9 +50,12 @@
public class SlideShowNode extends SimpleNodeImpl implements SlideShow {

protected XMLSlideShow slideshow;
protected String path;
protected String pathOrUl;
protected File pptFile;

/**
* get the SlideShow
*/
public XMLSlideShow getSlideshow() {
return slideshow;
}
Expand All @@ -61,13 +67,22 @@ public XMLSlideShow getSlideshow() {
* @param nodeQuery
* @throws Exception
*/
public SlideShowNode(SimpleGraph simpleGraph, String path, String... keys) {
public SlideShowNode(SimpleGraph simpleGraph, String pathOrUrl,
String... keys) {
super(simpleGraph, "slideshow", keys);
this.path = path;
pptFile = new File(path);
InputStream is = null;
try {
if (pptFile.exists())
slideshow = new XMLSlideShow(new FileInputStream(path));
try {
URL url = new URL(pathOrUrl);
is = url.openStream();
} catch (MalformedURLException e1) {
this.pathOrUl = pathOrUrl;
pptFile = new File(pathOrUl);
if (pptFile.canRead())
is = new FileInputStream(pathOrUl);
}
if (is != null)
slideshow = new XMLSlideShow(is);
else
slideshow = new XMLSlideShow();
} catch (IOException e) {
Expand All @@ -89,7 +104,7 @@ public CoreProperties getCoreProperties() {

@Override
public Map<String, Object> initMap() {
map.put("path", path);
map.put("path", pathOrUl);
CoreProperties cp = getCoreProperties();
map.put("title", cp.getTitle());
return map;
Expand Down Expand Up @@ -141,7 +156,7 @@ public void setTitle(String title) {

@Override
public void save() throws Exception {
FileOutputStream out = new FileOutputStream(path);
FileOutputStream out = new FileOutputStream(pathOrUl);
slideshow.write(out);
out.close();
slideshow.close();
Expand Down
Expand Up @@ -243,7 +243,7 @@ public void testPowerPointCreateWikiData() throws Exception {
"father", "mother", "date of birth", "place of birth", "date of death",
"place of death", "wiki_en", "label_en", "source" };
// add slides for children and grand children of queen victoria
this.addSlides(sls, mws, queenVictoria, slideprops, 1, debug);
this.addSlides(sls, mws, queenVictoria, slideprops, 2, debug);
sls.save();
TestWikiDataSystem.wikiDataSystem.close();
}
Expand Down Expand Up @@ -308,5 +308,18 @@ public void testPowerPointDoafterCreateAsGraph() throws Exception {
assertEquals(10, slides.size());
pps.graph().io(IoCore.graphml()).writeGraph("../simplegraph-powerpoint/QueenVictoriaPowerPoint.xml");
}

@Test
public void testReadPowerpoint() throws Exception {
PowerPointSystem pps=new PowerPointSystem();
pps.connect();
SimpleNode slideShowNode = pps.moveTo("https://www.its.leeds.ac.uk/fileadmin/documents/alumni/Michele_Dix_Leeds_University_-_FINAL.PPTX");
List<SimpleNode> slides = slideShowNode.out("slides")
.collect(Collectors.toCollection(ArrayList::new));
// debug=true;
if (debug)
slides.forEach(slide -> slide.printNameValues(System.out));
assertEquals(44, slides.size());
}

}
23 changes: 19 additions & 4 deletions simplegraph-smw/src/main/java/gov/nasa/worldwind/geom/Angle.java
@@ -1,7 +1,22 @@
/*
* Copyright (C) 2011 United States Government as represented by the Administrator of the
* National Aeronautics and Space Administration.
* All Rights Reserved.
/**
* Copyright (c) 2018 BITPlan GmbH
*
* http://www.bitplan.com
*
* This file is part of the Opensource project at:
* https://github.com/BITPlan/com.bitplan.simplegraph
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package gov.nasa.worldwind.geom;

Expand Down

0 comments on commit c65aff2

Please sign in to comment.