|
|
(46 intermediate revisions by 2 users not shown) |
Line 1: |
Line 1: |
− | {{Article|title=SimpleGraph|text=[https://github.com/BITPlan/com.bitplan.simplegraph SimpleGraph] | + | {{SimpleArticle|title=SimpleGraph|text={{OsProject|id=com.bitplan.simplegraph|owner=BITPlan|title=SimpleGraph System API wrapper|url=https://github.com/BITPlan/com.bitplan.simplegraph|version=0.0.5|date=2019-03-23}} |
− | is an open source project that allows to wrap Systems APIs in a way that graph algorithms and storage can be applied. As an implementation Apache Gremlin/Tinkerpop is used. | + | is an open source project that allows to wrap Systems APIs in a way that graph algorithms and storage can be applied. As an implementation [http://tinkerpop.apache.org Apache Tinkerpop/Gremlin] is used.}} |
− | = FileSystem example =
| |
| | | |
− | == Basics == | + | {{:SimpleGraph/Links}} |
− | A Filesystem is a graph. It consists of File and Directory nodes
| + | |
− | <graphviz>
| + | SimpleGraph uses the [http://www.enterpriseintegrationpatterns.com/ramblings/03_hubandspoke.html Hub and Spoke] and Adapter patterns heavily. |
− | digraph FileSystem {
| + | |
− | Directory -> File [ label="files" ]
| + | http://www.enterpriseintegrationpatterns.com/img/IntegrationSpaghetti.gif |
− | Directory -> Directory [ label="files" ]
| + | http://www.enterpriseintegrationpatterns.com/img/MessageBroker.gif |
− | File -> Directory [ label="parent" ]
| + | |
− | Directory -> Directory [ label="parent" ]
| + | = Modules = |
| + | There are currently {{#ask: [[Concept:SimpleGraphModule]]|format=count}} Modules available for SimpleGraph. |
| + | Each module wraps an "external" API to make the functions and data behind that API available for graph processing with Apache Tinkerpop / Gremlin. |
| + | == Module Hub and Spoke == |
| + | {{:SimpleGraphModuleHubAndSpoke}} |
| + | |
| + | == Module Details == |
| + | {{SimpleGraphModuleMarkup|#userparam=intro}} |
| + | {{#ask: [[Concept:SimpleGraphModule]] |
| + | | mainlabel=SimpleGraphModule |
| + | | ?SimpleGraphModule name = name |
| + | | ?SimpleGraphModule modulename = modulename |
| + | | ?SimpleGraphModule systemname = systemname |
| + | | ?SimpleGraphModule logo = logo |
| + | | ?SimpleGraphModule apiname = apiname |
| + | | ?SimpleGraphModule apiurl = apiurl |
| + | | ?SimpleGraphModule url = url |
| + | | ?SimpleGraphModule documentation = documentation |
| + | | sort=SimpleGraphModule name |
| + | | format=template |
| + | | link=none |
| + | | userparam=row |
| + | | named args=yes |
| + | | template=SimpleGraphModuleMarkup |
| + | }} |
| + | {{SimpleGraphModuleMarkup|#userparam=outro}} |
| + | |
| + | = Introduction = |
| + | {{SimpleArticle|title=Motivation|text=Solving IT Problems across System boundaries can get very difficult. There may be a wealth of APIs which first looks helpful but given the diversity of approaches |
| + | it a daunting task will need to be tackled to get reasonable results. More often than not projects are not even started since the cost/benefit ratio is not good enough. |
| + | SimpleGraph aims to supply a unified graph API access to Systems for which this makes sense. In fact for most systems it makes sense to have a graph API. Quite a few problems will get much easier to solve if the subdivision of the problem is done with the goal to apply graph algorithms. |
| + | See {{Link|target=SiGNaL#What_happens_if_you_view_the_world_as_a_graph.3F|title=What happens if you see the world as a graph?}} |
| + | }} |
| + | |
| + | {{SimpleArticle|title=Use Cases|text= |
| + | == Mix and Match Office and other data == |
| + | Let's assume we have a business that works in the following manner: |
| + | # There are pricelist for product categories in Microsoft Excel files |
| + | # Product specifications are in PDF Format - the files are referenced in the Excel files |
| + | # Invoices are written in Microsoft Word |
| + | # There is an address book of customers in VCard format |
| + | # Orders are handled via e-mail (that is automatically produced by the companies shop website) |
| + | # Monthly reports are created with PowerPoint |
| + | The monthly reports should in the future be modified to give geographical information. Basically a revenue/region sales count per product/region information is wanted. |
| + | |
| + | The 1000 dollar question - can this report be created efficiently semi-manually with reasonable software effort? |
| + | Sadly it sounds more like 10.000 or 100.000 dollar question. |
| + | |
| + | There are at least 6 different systems involved. |
| + | SimpleGraph simplifies accessing all 6 systems. |
| + | }} |
| + | {{SimpleArticle|title=Examples|text= |
| + | == Air Routes == |
| + | The AirRoutes example is taken from [http://kelvinlawrence.net/book/Gremlin-Graph-Guide.html Practical Gremlin: An Apache TinkerPop Tutorial by Kelvin Lawrence] see also https://github.com/krlawrence/graph. |
| + | <uml> |
| + | hide circle |
| + | package AirRoutes { |
| + | note top of airport: 3374 |
| + | class airport { |
| + | country |
| + | code |
| + | longest |
| + | city |
| + | elev |
| + | icao |
| + | lon |
| + | type |
| + | region |
| + | runways |
| + | lat |
| + | desc |
| + | } |
| + | note top of version: 1 |
| + | class version { |
| + | code |
| + | type |
| + | desc |
| + | } |
| + | note top of country: 237 |
| + | class country { |
| + | code |
| + | type |
| + | desc |
| + | } |
| + | note top of continent: 7 |
| + | class continent { |
| + | code |
| + | type |
| + | desc |
| + | } |
| } | | } |
− | </graphviz>
| |
− | There is parent-child relation between Directories and their subfiles. A Directory may contain files and directories. A file is always leaf of the the tree. A directory may be a leaf if it's empty.
| |
− | In our example we'll go from directories to the containing elements via the "files" edge/relation and from the files/directories to their parents via the "parent" edge.
| |
− | == Example goal ==
| |
− | We'd like to analyze some part of a filesystem and we'll use the "src" directory of the SimpleGraph project's source code as a starting point.
| |
| | | |
− | The graph below shows the source code structure for the SimpleGraph project with the root of the tree being the "src" directory. The nodes are clickable and will lead you to the corresponding file representation on github.
| + | airport --> airport: route |
− | === Example FileSystem Graph or "src" directory ===
| + | note on link: 43400 |
− | <!--
| + | |
− | this graph was generated 2018-01-26 16:48:51 | + | continent --> airport: contains |
− | by the graphvizTree.rythm template | + | note on link: 6748 |
− | see http://wiki.bitplan.com/index.php/SimpleGraph
| + | </uml> |
− | -->
| |
− | <graphviz>
| |
− | digraph FileSystemGraphForSrcDirectoryOfSimpleGraphGitHubOpenSourceProject { | |
− | rankdir="RL";
| |
− | "src/test/java/com" [ label="com" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com"]
| |
− | "src" [ label="src" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src"]
| |
− | "src/main/java/com/bitplan/mediawiki/MediaWikiSystem.java" [ label="MediaWikiSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/mediawiki/MediaWikiSystem.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestJson.java" [ label="TestJson.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestJson.java"]
| |
− | "src/main/java/com/bitplan/powerpoint" [ label="powerpoint" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/powerpoint"]
| |
− | "src/main/java/com/bitplan/json/JsonNode.java" [ label="JsonNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/json/JsonNode.java"]
| |
− | "src/test" [ label="test" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test"]
| |
− | "src/main/java/com/bitplan/simplegraph/SimpleSystem.java" [ label="SimpleSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/SimpleSystem.java"]
| |
− | "src/test/java/com/bitplan" [ label="bitplan" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan"]
| |
− | "src/main/rythm/test.rythm" [ label="test.rythm" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/rythm/test.rythm"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestDebug.java" [ label="TestDebug.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestDebug.java"]
| |
− | "src/main/java/com/bitplan/simplegraph" [ label="simplegraph" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph"]
| |
− | "src/main/java/com/bitplan/json/JsonPrettyPrinter.java" [ label="JsonPrettyPrinter.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/json/JsonPrettyPrinter.java"]
| |
− | "src/etc" [ label="etc" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/etc"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/Holder.java" [ label="Holder.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/impl/Holder.java"]
| |
− | "src/test/java/com/bitplan/simplegraph" [ label="simplegraph" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph"]
| |
− | "src/main/rythm/graphvizTree.rythm" [ label="graphvizTree.rythm" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/rythm/graphvizTree.rythm"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestSuite.java" [ label="TestSuite.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestSuite.java"]
| |
− | "src/main/java/com/bitplan/wikidata" [ label="wikidata" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/wikidata"]
| |
− | "src/main/java/com/bitplan/json/JsonSystem.java" [ label="JsonSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/json/JsonSystem.java"]
| |
− | "src/main" [ label="main" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/SimpleSystemImpl.java" [ label="SimpleSystemImpl.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/impl/SimpleSystemImpl.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestSMW.java" [ label="TestSMW.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestSMW.java"]
| |
− | "src/etc/header.txt" [ label="header.txt" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/etc/header.txt"]
| |
− | "src/main/java/com/bitplan/smw" [ label="smw" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/smw"]
| |
− | "src/main/java/com/bitplan/powerpoint/SlideShowNode.java" [ label="SlideShowNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/powerpoint/SlideShowNode.java"]
| |
− | "src/test/employee.json" [ label="employee.json" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/employee.json"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/KeysImpl.java" [ label="KeysImpl.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/impl/KeysImpl.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/BaseTest.java" [ label="BaseTest.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/BaseTest.java"]
| |
− | "src/main/java" [ label="java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java"]
| |
− | "src/main/java/com/bitplan/rythm" [ label="rythm" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/rythm"]
| |
− | "src/main/java/com/bitplan/powerpoint/SlideImage.java" [ label="SlideImage.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/powerpoint/SlideImage.java"]
| |
− | "src/test/air-routes-small.graphml" [ label="air-routes-small.graphml" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/air-routes-small.graphml"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/SimpleNodeImpl.java" [ label="SimpleNodeImpl.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/impl/SimpleNodeImpl.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestMediaWiki.java" [ label="TestMediaWiki.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestMediaWiki.java"]
| |
− | "src/main/rythm" [ label="rythm" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/rythm"]
| |
− | "src/main/java/com/bitplan/mediawiki" [ label="mediawiki" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/mediawiki"]
| |
− | "src/main/java/com/bitplan/powerpoint/SlideShow.java" [ label="SlideShow.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/powerpoint/SlideShow.java"]
| |
− | "src/test/resources" [ label="resources" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/resources"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/Cache.java" [ label="Cache.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/impl/Cache.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestRythm.java" [ label="TestRythm.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestRythm.java"]
| |
− | "src/main/java/com" [ label="com" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com"]
| |
− | "src/main/java/com/bitplan/gremlin/RegexPredicate.java" [ label="RegexPredicate.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/gremlin/RegexPredicate.java"]
| |
− | "src/main/java/com/bitplan/powerpoint/SlideNode.java" [ label="SlideNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/powerpoint/SlideNode.java"]
| |
− | "src/test/java" [ label="java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/SimpleGraphImpl.java" [ label="SimpleGraphImpl.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/impl/SimpleGraphImpl.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestWikiData.java" [ label="TestWikiData.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestWikiData.java"]
| |
− | "src/main/java/com/bitplan" [ label="bitplan" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan"]
| |
− | "src/main/java/com/bitplan/triplestore/TripleStoreSystem.java" [ label="TripleStoreSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/triplestore/TripleStoreSystem.java"]
| |
− | "src/main/java/com/bitplan/powerpoint/PowerPointSystem.java" [ label="PowerPointSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/powerpoint/PowerPointSystem.java"]
| |
− | "src/test/air-routes.graphml" [ label="air-routes.graphml" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/air-routes.graphml"]
| |
− | "src/main/java/com/bitplan/wikidata/WikiDataNode.java" [ label="WikiDataNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/wikidata/WikiDataNode.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestTinkerPop3.java" [ label="TestTinkerPop3.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestTinkerPop3.java"]
| |
− | "src/main/java/com/bitplan/gremlin" [ label="gremlin" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/gremlin"]
| |
− | "src/main/java/com/bitplan/triplestore/TripleNode.java" [ label="TripleNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/triplestore/TripleNode.java"]
| |
− | "src/main/java/com/bitplan/powerpoint/Slide.java" [ label="Slide.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/powerpoint/Slide.java"]
| |
− | "src/test/menu.json" [ label="menu.json" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/menu.json"]
| |
− | "src/main/java/com/bitplan/wikidata/WikiDataSystem.java" [ label="WikiDataSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/wikidata/WikiDataSystem.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestFileSystem.java" [ label="TestFileSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestFileSystem.java"]
| |
− | "src/main/java/com/bitplan/triplestore" [ label="triplestore" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/triplestore"]
| |
− | "src/main/java/com/bitplan/filesystem/FileSystem.java" [ label="FileSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/filesystem/FileSystem.java"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl" [ label="impl" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/impl"]
| |
− | "src/test/pets.json" [ label="pets.json" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/pets.json"]
| |
− | "src/main/java/com/bitplan/smw/SMWSystem.java" [ label="SMWSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/smw/SMWSystem.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestTripleStore.java" [ label="TestTripleStore.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestTripleStore.java"]
| |
− | "src/main/java/com/bitplan/filesystem" [ label="filesystem" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/filesystem"]
| |
− | "src/main/java/com/bitplan/filesystem/FileNode.java" [ label="FileNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/filesystem/FileNode.java"]
| |
− | "src/main/java/com/bitplan/simplegraph/SimpleGraph.java" [ label="SimpleGraph.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/SimpleGraph.java"]
| |
− | "src/test/resources/sidif" [ label="sidif" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/resources/sidif"]
| |
− | "src/main/java/com/bitplan/rythm/RythmContext.java" [ label="RythmContext.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/rythm/RythmContext.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestPowerPoint.java" [ label="TestPowerPoint.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestPowerPoint.java"]
| |
− | "src/main/java/com/bitplan/map" [ label="map" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/map"]
| |
− | "src/main/java/com/bitplan/map/MapNode.java" [ label="MapNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/map/MapNode.java"]
| |
− | "src/main/java/com/bitplan/simplegraph/Keys.java" [ label="Keys.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/Keys.java"]
| |
− | "src/test/resources/sidif/royal92.sidif" [ label="royal92.sidif" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/resources/sidif/royal92.sidif"]
| |
− | "src/main/java/com/bitplan/mediawiki/MediaWikiPageNode.java" [ label="MediaWikiPageNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/mediawiki/MediaWikiPageNode.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestMapSystem.java" [ label="TestMapSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestMapSystem.java"]
| |
− | "src/main/java/com/bitplan/json" [ label="json" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/json"]
| |
− | "src/main/java/com/bitplan/map/MapSystem.java" [ label="MapSystem.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/map/MapSystem.java"]
| |
− | "src/main/java/com/bitplan/simplegraph/SimpleNode.java" [ label="SimpleNode.java" URL="https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/java/com/bitplan/simplegraph/SimpleNode.java"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestMapSystem.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/map/MapSystem.java" -> "src/main/java/com/bitplan/map" [ label="parent"]
| |
− | "src/main/java/com/bitplan/mediawiki/MediaWikiSystem.java" -> "src/main/java/com/bitplan/mediawiki" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestJson.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/json/JsonNode.java" -> "src/main/java/com/bitplan/json" [ label="parent"]
| |
− | "src/test" -> "src" [ label="parent"]
| |
− | "src/main/rythm/test.rythm" -> "src/main/rythm" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestDebug.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/json/JsonPrettyPrinter.java" -> "src/main/java/com/bitplan/json" [ label="parent"]
| |
− | "src/etc" -> "src" [ label="parent"]
| |
− | "src/main/rythm/graphvizTree.rythm" -> "src/main/rythm" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestSuite.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/json/JsonSystem.java" -> "src/main/java/com/bitplan/json" [ label="parent"]
| |
− | "src/main" -> "src" [ label="parent"]
| |
− | "src/etc/header.txt" -> "src/etc" [ label="parent"]
| |
− | "src/main/java/com/bitplan/powerpoint/SlideShowNode.java" -> "src/main/java/com/bitplan/powerpoint" [ label="parent"]
| |
− | "src/test/employee.json" -> "src/test" [ label="parent"]
| |
− | "src/main/java" -> "src/main" [ label="parent"]
| |
− | "src/main/java/com/bitplan/powerpoint/SlideImage.java" -> "src/main/java/com/bitplan/powerpoint" [ label="parent"]
| |
− | "src/test/air-routes-small.graphml" -> "src/test" [ label="parent"]
| |
− | "src/main/rythm" -> "src/main" [ label="parent"]
| |
− | "src/main/java/com/bitplan/powerpoint/SlideShow.java" -> "src/main/java/com/bitplan/powerpoint" [ label="parent"]
| |
− | "src/test/resources" -> "src/test" [ label="parent"]
| |
− | "src/main/java/com" -> "src/main/java" [ label="parent"]
| |
− | "src/main/java/com/bitplan/powerpoint/SlideNode.java" -> "src/main/java/com/bitplan/powerpoint" [ label="parent"]
| |
− | "src/test/java" -> "src/test" [ label="parent"]
| |
− | "src/main/java/com/bitplan" -> "src/main/java/com" [ label="parent"]
| |
− | "src/main/java/com/bitplan/powerpoint/PowerPointSystem.java" -> "src/main/java/com/bitplan/powerpoint" [ label="parent"]
| |
− | "src/test/air-routes.graphml" -> "src/test" [ label="parent"]
| |
− | "src/main/java/com/bitplan/gremlin" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/powerpoint/Slide.java" -> "src/main/java/com/bitplan/powerpoint" [ label="parent"]
| |
− | "src/test/menu.json" -> "src/test" [ label="parent"]
| |
− | "src/main/java/com/bitplan/triplestore" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl" -> "src/main/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/test/pets.json" -> "src/test" [ label="parent"]
| |
− | "src/main/java/com/bitplan/filesystem" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/SimpleGraph.java" -> "src/main/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/test/resources/sidif" -> "src/test/resources" [ label="parent"]
| |
− | "src/main/java/com/bitplan/map" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/Keys.java" -> "src/main/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/test/resources/sidif/royal92.sidif" -> "src/test/resources/sidif" [ label="parent"]
| |
− | "src/main/java/com/bitplan/json" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/SimpleNode.java" -> "src/main/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/test/java/com" -> "src/test/java" [ label="parent"]
| |
− | "src/main/java/com/bitplan/powerpoint" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/SimpleSystem.java" -> "src/main/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/test/java/com/bitplan" -> "src/test/java/com" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/Holder.java" -> "src/main/java/com/bitplan/simplegraph/impl" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph" -> "src/test/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/wikidata" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/SimpleSystemImpl.java" -> "src/main/java/com/bitplan/simplegraph/impl" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestSMW.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/smw" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/KeysImpl.java" -> "src/main/java/com/bitplan/simplegraph/impl" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/BaseTest.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/rythm" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/SimpleNodeImpl.java" -> "src/main/java/com/bitplan/simplegraph/impl" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestMediaWiki.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/mediawiki" -> "src/main/java/com/bitplan" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/Cache.java" -> "src/main/java/com/bitplan/simplegraph/impl" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestRythm.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/gremlin/RegexPredicate.java" -> "src/main/java/com/bitplan/gremlin" [ label="parent"]
| |
− | "src/main/java/com/bitplan/simplegraph/impl/SimpleGraphImpl.java" -> "src/main/java/com/bitplan/simplegraph/impl" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestWikiData.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/triplestore/TripleStoreSystem.java" -> "src/main/java/com/bitplan/triplestore" [ label="parent"]
| |
− | "src/main/java/com/bitplan/wikidata/WikiDataNode.java" -> "src/main/java/com/bitplan/wikidata" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestTinkerPop3.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/triplestore/TripleNode.java" -> "src/main/java/com/bitplan/triplestore" [ label="parent"]
| |
− | "src/main/java/com/bitplan/wikidata/WikiDataSystem.java" -> "src/main/java/com/bitplan/wikidata" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestFileSystem.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/filesystem/FileSystem.java" -> "src/main/java/com/bitplan/filesystem" [ label="parent"]
| |
− | "src/main/java/com/bitplan/smw/SMWSystem.java" -> "src/main/java/com/bitplan/smw" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestTripleStore.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/filesystem/FileNode.java" -> "src/main/java/com/bitplan/filesystem" [ label="parent"]
| |
− | "src/main/java/com/bitplan/rythm/RythmContext.java" -> "src/main/java/com/bitplan/rythm" [ label="parent"]
| |
− | "src/test/java/com/bitplan/simplegraph/TestPowerPoint.java" -> "src/test/java/com/bitplan/simplegraph" [ label="parent"]
| |
− | "src/main/java/com/bitplan/map/MapNode.java" -> "src/main/java/com/bitplan/map" [ label="parent"]
| |
− | "src/main/java/com/bitplan/mediawiki/MediaWikiPageNode.java" -> "src/main/java/com/bitplan/mediawiki" [ label="parent"]
| |
− | } | |
− | </graphviz>
| |
− | == explanation ==
| |
− | === creating the graph ===
| |
− | This graph visualization has been produced with the following Java lines which make sure that the
| |
− | "src" Directory can be handled as a gremlin graph:
| |
− | <source lang='java'> | |
− | // create a new FileSystem acces supplying the result as a SimpleSystem API
| |
− | SimpleSystem fs=new FileSystem();
| |
− | // connect to this system with no extra information (e.g. no credentials) and move to the "src" node
| |
− | SimpleNode start = fs.connect("").moveTo("src");
| |
− | // do gremlin style out traversals recusively to any depth
| |
− | start.recursiveOut("files",Integer.MAX_VALUE);
| |
− | </source>
| |
− | === converting the graph to graphviz ===
| |
− | The graph is now available and can be traversed to create a graphviz version of it. We use
| |
− | the {{Link|target=Rythm}} template engine to do so. Within Rythm you can use Java code.
| |
− | Basically we try out the code in the
| |
− | [https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/test/java/com/bitplan/simplegraph/TestRythm.java TestRythm JUnit test] and then use it in the Rythm template
| |
− | [https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/src/main/rythm/graphvizTree.rythm graphvizTree.rythm]
| |
| | | |
− | = MapSystem example = | + | == JUnit Test case == |
− | The MapSystem is a simple wrapper for a graph with nodes that have key/value pairs. We would not really need this since Apache Tinkerpop/Gremlin already supplies us with properties per node/vertex.
| + | We'd like to read in the air-routes graph described above and create an Excel Work book from it. |
− | Still this system is useful as a helper system and to illustrate the wrapping concepts and possibilities of SimpleGraph
| + | see [https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/simplegraph-excel/src/test/java/com/bitplan/simplegraph/excel/TestExcelSystem.java TestExcelSystem.java] |
− | == Unit Test == | + | === Java Source Code === |
| <source lang='java'> | | <source lang='java'> |
− | public void testMapSystem() throws Exception {
| + | ExcelSystem es = new ExcelSystem(); |
− | MapSystem ms=new MapSystem();
| + | Graph graph = TestTinkerPop3.getAirRoutes(); |
− | ms.connect();
| + | GraphTraversalSource g = graph.traversal(); |
− | Map[] carbrandmaps= {
| + | Workbook wb = es.createWorkBook(g); |
− | initMap("name","Ferrari","country","Italy","wikidataid","Q27586"),
| + | assertEquals(6, wb.getNumberOfSheets()); |
− | initMap("name","Porsche","country","Germany","wikidataid","Q40993"),
| + | es.save(wb, testAirRouteFileName); |
− | initMap("name","Ford","cuntry","United States","wikidataid","Q44294")
| |
− | };
| |
− | Map[] carmakemaps= {
| |
− | initMap("name","308","year",1984,"wikidataid","Q1407659","brand","Ferrari"),
| |
− | initMap("name","328","year",1989,"wikidataid","Q1407669","brand","Ferrari"),
| |
− | initMap("name","901","year",1964,"wikidataid","Q2104537","brand","Porsche"),
| |
− | initMap("name","2017 GT","year",2017,"wikidataid","Q23856323","brand","Ford")
| |
− | };
| |
− | MapNode startNode=null;
| |
− | for (Map map:carbrandmaps) {
| |
− | startNode=new MapNode(ms,"carbrand",map);
| |
− | }
| |
− | for (Map map:carmakemaps) {
| |
− | MapNode mapNode=new MapNode(ms,"car",map);
| |
− | ms.g().V().hasLabel("carbrand").has("name",map.get("brand")).forEachRemaining(brandNode->{
| |
− | brandNode.addEdge("brand", mapNode.getVertex());
| |
− | });
| |
− | }
| |
− | // any node will do
| |
− | ms.setStartNode(startNode);
| |
− | debug=true;
| |
− | if (debug)
| |
− | ms.g().V().forEachRemaining(SimpleNode.printDebug);
| |
− | String graphViz = TestRythm.generateGraphViz(ms.getStartNode(), "brand", "name", "wikidataid",
| |
− | WIKIDATA_URL_PREFIX,"RL","CarGraph");
| |
− | // debug = true;
| |
− | if (debug)
| |
− | System.out.println(graphViz.trim());
| |
− | assertTrue(graphViz.contains("\"Q27586\" [ label=\"Ferrari\" URL=\"https://www.wikidata.org/wiki/Q27586\"]"));
| |
− | }
| |
| </source> | | </source> |
− | == Graph ==
| + | View the resulting [[File:Air-routes.xlsx]] Excel file to |
− | <!--
| + | see what the tabular version of the graph looks like. |
− | this graph was generated 2018-01-26 17:00:02
| + | }} |
− | by the graphvizTree.rythm template
| + | = Links = |
− | see http://wiki.bitplan.com/index.php/SimpleGraph
| + | * [https://stackoverflow.com/questions/tagged/simplegraph SimpleGraph Stackoverflow Questions] |
− | -->
| + | * [https://groups.google.com/forum/#!forum/simplegraph Google SimpleGraph Discussion Group] |
− | <graphviz>
| |
− | digraph CarGraph {
| |
− | rankdir="RL";
| |
− | "Q27586" [ label="Ferrari" URL="https://www.wikidata.org/wiki/Q27586"]
| |
− | "Q23856323" [ label="2017 GT" URL="https://www.wikidata.org/wiki/Q23856323"]
| |
− | "Q40993" [ label="Porsche" URL="https://www.wikidata.org/wiki/Q40993"]
| |
− | "Q1407669" [ label="328" URL="https://www.wikidata.org/wiki/Q1407669"]
| |
− | "Q44294" [ label="Ford" URL="https://www.wikidata.org/wiki/Q44294"]
| |
− | "Q2104537" [ label="901" URL="https://www.wikidata.org/wiki/Q2104537"]
| |
− | "Q1407659" [ label="308" URL="https://www.wikidata.org/wiki/Q1407659"]
| |
− | "Q40993" -> "Q2104537" [ label="brand"]
| |
− | "Q27586" -> "Q1407659" [ label="brand"]
| |
− | "Q44294" -> "Q23856323" [ label="brand"]
| |
− | "Q27586" -> "Q1407669" [ label="brand"]
| |
− | }
| |
− | </graphviz>
| |
| | | |
| + | = Documentation = |
| + | {{Article|title=Links|text= |
| + | * {{Link|target=SimpleGraph-Installation}} |
| + | * {{Link|target=SimpleGraph-Tutorial}} |
| + | * {{Link|target=SimpleGraph-Core}} |
| }} | | }} |
− |
| |
| [[Category:frontend]] | | [[Category:frontend]] |
| [[Category:SiGNaL]] | | [[Category:SiGNaL]] |
| + | [[Category:SimpleGraph]] |