Difference between revisions of "SimpleGraph-Core"

From BITPlan Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
Basically SimpleGraph core has the idea of Vertex and Edges being able to carry "payloads". Some of the payload data will be replicated as properties to be
+
Basically {{Link|target=SimpleGraph}}-core has the idea of Vertex and Edges being able to carry "payloads". Some of the payload data will be replicated as properties to be
 
able to search for the payload and do something with it but the main thing is to have some kind of pointer/key that a certain SimpleGraph Module will be able work with to
 
able to search for the payload and do something with it but the main thing is to have some kind of pointer/key that a certain SimpleGraph Module will be able work with to
 
allow working with the API for the payload.
 
allow working with the API for the payload.
  
 
Going from a Vertex to a Payload (which is a JavaObject) is currently done with a property SimpleNode.SELF_LABEL
 
Going from a Vertex to a Payload (which is a JavaObject) is currently done with a property SimpleNode.SELF_LABEL
 +
see https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/simplegraph-core/src/main/java/com/bitplan/simplegraph/core/SimpleNode.java
 +
<source lang='java'>
 +
Object payLoad=v.property(SimpleNode.SELF_LABEL).value();
 +
</source>
 +
In some cases it might be necessary to find a Vertex for a Payload. Currently we use a work-around by putting the Java hashCode of a payload as a property "java.hashCode" into the corresponding Edge or Vertex. This way we can simply lookup the Java Object with
 +
<source lang='java'>
 +
Vertex myVertex=g.V().has("java.hashCode",this.hashCode())
 +
</source>
  
see https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/simplegraph-core/src/main/java/com/bitplan/simplegraph/core/SimpleNode.java
 
 
= Example =
 
= Example =
Lets's assume we'd like to acces some data about [https://en.wikipedia.org/wiki/List_of_gravitational_wave_observations Gravitational Wave observations].
+
Lets's assume we'd like to access some data about [https://en.wikipedia.org/wiki/List_of_gravitational_wave_observations Gravitational Wave observations].
 
A Source for general information on these events is WikiData where you can get a list of the events with a [https://query.wikidata.org/#%23%20Find%20Gravitational%20wave%20events%0A%23%20Created%202018-10-16%20by%20Wolfgang%20Fahl%20BITPlan%20GmbH%0A%23%0A%23%20select%20the%20events%0ASELECT%20%3Fevent%20%3FcatalogCode%20%3Fdiscovery%20%3FeventLabel%20%3Fduration%20%3Flodurl%20%3Farticle%20%0AWHERE%20%0A%7B%0A%20%20%23%20any%20subject%0A%20%20%23%20which%20is%20an%20instance%20of%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP31%0A%20%20%0A%20%20%23%20gravitational%20wave%20event%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FQ24748034%0A%20%20%3Fevent%20wdt%3AP31%20wd%3AQ24748034.%0A%20%20%0A%20%20%23%20and%20might%20hava%20catalog%20code%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP528%0A%20%20%23%20catalog%20Code%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fevent%20wdt%3AP528%20%3FcatalogCode%0A%20%20%7D%0A%20%20%0A%20%20%23%20and%20might%20have%20a%20time%20of%20discovery%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP575%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fevent%20wdt%3AP575%20%3Fdiscovery%0A%20%20%7D%20%20%20%0A%20%20%0A%20%20%23%20and%20might%20have%20a%20time%20duration%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP2047%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fevent%20wdt%3AP2047%20%3Fduration%0A%20%20%7D%20%20%20%0A%20%20%0A%20%20%23%20and%20might%20have%20a%20linked%20open%20data%20url%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP973%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fevent%20wdt%3AP973%20%3Flodurl%0A%20%20%7D%20%20%20%0A%20%20%0A%20%20%23%20show%20the%20Labels%20%28e.g.%20eventLabel%29%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20...%20include%20the%20labels%0A%20%20%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22%0A%20%20%7D%0A%20%20%0A%20%20%23%20the%20event%20might%20have%20an%20english%20wikipedia%20article%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%20%20%3Farticle%20schema%3Aabout%20%3Fevent%20.%0A%20%20%20%20%20%20%3Farticle%20schema%3AinLanguage%20%22en%22%20.%0A%20%20%20%20%20%20FILTER%20%28SUBSTR%28str%28%3Farticle%29%2C%201%2C%2025%29%20%3D%20concat%28%22https%3A%2F%2Fen.wikipedia.org%2F%22%29%29%0A%20%20%7D%0A%7D%0Aorder%20by%20%3Fdiscovery%0A SPARQL query].
 
A Source for general information on these events is WikiData where you can get a list of the events with a [https://query.wikidata.org/#%23%20Find%20Gravitational%20wave%20events%0A%23%20Created%202018-10-16%20by%20Wolfgang%20Fahl%20BITPlan%20GmbH%0A%23%0A%23%20select%20the%20events%0ASELECT%20%3Fevent%20%3FcatalogCode%20%3Fdiscovery%20%3FeventLabel%20%3Fduration%20%3Flodurl%20%3Farticle%20%0AWHERE%20%0A%7B%0A%20%20%23%20any%20subject%0A%20%20%23%20which%20is%20an%20instance%20of%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP31%0A%20%20%0A%20%20%23%20gravitational%20wave%20event%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FQ24748034%0A%20%20%3Fevent%20wdt%3AP31%20wd%3AQ24748034.%0A%20%20%0A%20%20%23%20and%20might%20hava%20catalog%20code%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP528%0A%20%20%23%20catalog%20Code%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fevent%20wdt%3AP528%20%3FcatalogCode%0A%20%20%7D%0A%20%20%0A%20%20%23%20and%20might%20have%20a%20time%20of%20discovery%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP575%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fevent%20wdt%3AP575%20%3Fdiscovery%0A%20%20%7D%20%20%20%0A%20%20%0A%20%20%23%20and%20might%20have%20a%20time%20duration%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP2047%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fevent%20wdt%3AP2047%20%3Fduration%0A%20%20%7D%20%20%20%0A%20%20%0A%20%20%23%20and%20might%20have%20a%20linked%20open%20data%20url%0A%20%20%23%20https%3A%2F%2Fwww.wikidata.org%2Fwiki%2FProperty%3AP973%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%3Fevent%20wdt%3AP973%20%3Flodurl%0A%20%20%7D%20%20%20%0A%20%20%0A%20%20%23%20show%20the%20Labels%20%28e.g.%20eventLabel%29%0A%20%20SERVICE%20wikibase%3Alabel%20%7B%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%23%20...%20include%20the%20labels%0A%20%20%20%20%20%20%20%20bd%3AserviceParam%20wikibase%3Alanguage%20%22%5BAUTO_LANGUAGE%5D%2Cen%22%0A%20%20%7D%0A%20%20%0A%20%20%23%20the%20event%20might%20have%20an%20english%20wikipedia%20article%0A%20%20OPTIONAL%20%7B%0A%20%20%20%20%20%20%3Farticle%20schema%3Aabout%20%3Fevent%20.%0A%20%20%20%20%20%20%3Farticle%20schema%3AinLanguage%20%22en%22%20.%0A%20%20%20%20%20%20FILTER%20%28SUBSTR%28str%28%3Farticle%29%2C%201%2C%2025%29%20%3D%20concat%28%22https%3A%2F%2Fen.wikipedia.org%2F%22%29%29%0A%20%20%7D%0A%7D%0Aorder%20by%20%3Fdiscovery%0A SPARQL query].
<graphviz>
+
<graphviz format='svg'>
digraph example1 {
+
digraph example2 {
   WikiData -> GW150914
+
  GW150914 [ URL="[https://en.wikipedia.org/wiki/First_observation_of_gravitational_waves|Wikipedia Article on GW150914]" ]
   WikiData -> GW151226
+
  GW151226 [ URL="[https://en.wikipedia.org/wiki/GW151226|Wikipedia Article on GW151226]" ]
 +
  GW170817 [ URL="[https://en.wikipedia.org/wiki/GW170817|Wikipedia Article on GW170817]" ]
 +
  WikiData [ URL="[[SimpleGraph-WikiData]]" ]
 +
   WikiData -> GW150914  
 +
   WikiData -> GW151226  
 
   WikiData -> GW170817
 
   WikiData -> GW170817
 
}
 
}
Line 30: Line 41:
 
# {{Link|target=SimpleGraph-HTML}} to extract the link to the original hdf5 files from the observatories
 
# {{Link|target=SimpleGraph-HTML}} to extract the link to the original hdf5 files from the observatories
 
# {{Link|target=SimpleGraph-HDF5}} to get to the event details and the original measurement data
 
# {{Link|target=SimpleGraph-HDF5}} to get to the event details and the original measurement data
 +
 
= Sources =
 
= Sources =
 
* https://github.com/BITPlan/com.bitplan.simplegraph/tree/master/simplegraph-core
 
* https://github.com/BITPlan/com.bitplan.simplegraph/tree/master/simplegraph-core
  
 
[[Category:SimpleGraph]][[Category:frontend]]
 
[[Category:SimpleGraph]][[Category:frontend]]

Latest revision as of 10:13, 17 October 2018

Basically SimpleGraph-core has the idea of Vertex and Edges being able to carry "payloads". Some of the payload data will be replicated as properties to be able to search for the payload and do something with it but the main thing is to have some kind of pointer/key that a certain SimpleGraph Module will be able work with to allow working with the API for the payload.

Going from a Vertex to a Payload (which is a JavaObject) is currently done with a property SimpleNode.SELF_LABEL see https://github.com/BITPlan/com.bitplan.simplegraph/blob/master/simplegraph-core/src/main/java/com/bitplan/simplegraph/core/SimpleNode.java

Object payLoad=v.property(SimpleNode.SELF_LABEL).value();

In some cases it might be necessary to find a Vertex for a Payload. Currently we use a work-around by putting the Java hashCode of a payload as a property "java.hashCode" into the corresponding Edge or Vertex. This way we can simply lookup the Java Object with

Vertex myVertex=g.V().has("java.hashCode",this.hashCode())

Example

Lets's assume we'd like to access some data about Gravitational Wave observations. A Source for general information on these events is WikiData where you can get a list of the events with a SPARQL query.

Each event is represented as a Vertex. The main info is the event name e.g. "GW150914" with that name you can lookup more detail on the event e.g. You'll find wikipedia articles for it or the source of linked opendata from the Ligo Observatory:

GW150914


Now you might be interested in some details that are not available via WikiData. https://www.gw-openscience.org/events/GW150914/ for instance has link to the orginal HDF5 datasets from the two detectors Hanford and Livingston:

To read the data you'd now have to download a HDFView software to find the starttime of the event as GPS Time 1126259446 UTC 2015-09-14T09:50:29.

Let's simplify this process by using three modules from the SimpleGraphProject

  1. SimpleGraph-WikiData to get the general event data from WikiData with the link to Linked Open Data URL
  2. SimpleGraph-HTML to extract the link to the original hdf5 files from the observatories
  3. SimpleGraph-HDF5 to get to the event details and the original measurement data

Sources