Details
-
New Feature
-
Status: Reopened
-
Minor
-
Resolution: Unresolved
-
7.2, 7.2.1, 7.3, 7.3.1, 7.4
-
None
-
Hello,
I am trying to export graph data from a Solr index (version 7.2) in a format that can be imported to Gephi for visualization. I'm getting close! Is there a way to add edge labels to the exports from this type of command (see curl command that follows and sample outputs)?
Thanks in advance,
-heidiBased on the examples found here: https://lucene.apache.org/solr/guide/7_2/graph-traversal.html , this is working in my GDELT-based data set query request:
curl --data-urlencode 'expr=nodes(gdelt_graph,
nodes(gdelt_graph,
walk="POLICE->Actor1Name_s",
trackTraversal="true",
gather="Actor2Name_s"),
walk="node->Actor1Name_s",
scatter="leaves,branches",
trackTraversal="true",
gather="Actor2Name_s")' http://mymachine:8983/solr/gdelt_graph/graphOutput is like this (just a subset):
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<graph id="G" edgedefault="directed">
<node id="POLICE">
<data key="field">node</data>
<data key="level">0</data>
</node>
<edge id="1" source="BANGLADESH" target="POLICE"/>
<node id="HOSPITAL">
<data key="field">Actor2Name_s</data>
<data key="level">1</data>
</node>
<edge id="2" source="POLICE" target="HOSPITAL"/>
<node id="UNITED STATES">
<data key="field">Actor2Name_s</data>
<data key="level">1</data>
</node>
<edge id="3" source="UNITED STATES" target="UNITED STATES"/>
<edge id="4" source="AFRICA" target="UNITED STATES"/>
<edge id="5" source="POLICE" target="UNITED STATES"/>And I'd like to have a key for label and the data tag on the edges so that I can get the Labels into Gephi. Does anyone know if this can be done? Below is example of what I mean. Notice the key for label at the top of the file and the "This is an edge description" entries on two of the edges (ids 1 and 2).
<?xml version="1.0" encoding="UTF-8"?>
<graphml xmlns="http://graphml.graphdrawing.org/xmlns"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd">
<key id="label" for="edge" attr.name="label" attr.type="string"/>
<graph id="G" edgedefault="directed">
<node id="POLICE">
<data key="field">node</data>
<data key="level">0</data>
</node>
<edge id="1" source="BANGLADESH" target="POLICE" label="foo">
<data key="label">This is an edge description.</data>
</edge>
<node id="HOSPITAL">
<data key="field">Actor2Name_s</data>
<data key="level">1</data>
</node>
<edge id="2" source="POLICE" target="HOSPITAL">
<data key="label">This is an edge description.</data>
</edge>
<node id="UNITED STATES">
<data key="field">Actor2Name_s</data>
<data key="level">1</data>
</node>
<edge id="3" source="UNITED STATES" target="UNITED STATES"/>
<edge id="4" source="AFRICA" target="UNITED STATES"/>
<edge id="5" source="POLICE" target="UNITED STATES"/>Hello, I am trying to export graph data from a Solr index (version 7.2) in a format that can be imported to Gephi for visualization. I'm getting close! Is there a way to add edge labels to the exports from this type of command (see curl command that follows and sample outputs)? Thanks in advance, -heidi Based on the examples found here: https://lucene.apache.org/solr/guide/7_2/graph-traversal.html , this is working in my GDELT-based data set query request: curl --data-urlencode 'expr=nodes(gdelt_graph, nodes(gdelt_graph, walk="POLICE->Actor1Name_s", trackTraversal="true", gather="Actor2Name_s"), walk="node->Actor1Name_s", scatter="leaves,branches", trackTraversal="true", gather="Actor2Name_s")' http://mymachine:8983/solr/gdelt_graph/graph Output is like this (just a subset): <?xml version="1.0" encoding="UTF-8"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd "> <graph id="G" edgedefault="directed"> <node id="POLICE"> <data key="field">node</data> <data key="level">0</data> </node> <edge id="1" source="BANGLADESH" target="POLICE"/> <node id="HOSPITAL"> <data key="field">Actor2Name_s</data> <data key="level">1</data> </node> <edge id="2" source="POLICE" target="HOSPITAL"/> <node id="UNITED STATES"> <data key="field">Actor2Name_s</data> <data key="level">1</data> </node> <edge id="3" source="UNITED STATES" target="UNITED STATES"/> <edge id="4" source="AFRICA" target="UNITED STATES"/> <edge id="5" source="POLICE" target="UNITED STATES"/> And I'd like to have a key for label and the data tag on the edges so that I can get the Labels into Gephi. Does anyone know if this can be done? Below is example of what I mean. Notice the key for label at the top of the file and the "This is an edge description" entries on two of the edges (ids 1 and 2). <?xml version="1.0" encoding="UTF-8"?> <graphml xmlns="http://graphml.graphdrawing.org/xmlns" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://graphml.graphdrawing.org/xmlns http://graphml.graphdrawing.org/xmlns/1.0/graphml.xsd "> <key id="label" for="edge" attr.name="label" attr.type="string"/> <graph id="G" edgedefault="directed"> <node id="POLICE"> <data key="field">node</data> <data key="level">0</data> </node> <edge id="1" source="BANGLADESH" target="POLICE" label="foo"> <data key="label">This is an edge description.</data> </edge> <node id="HOSPITAL"> <data key="field">Actor2Name_s</data> <data key="level">1</data> </node> <edge id="2" source="POLICE" target="HOSPITAL"> <data key="label">This is an edge description.</data> </edge> <node id="UNITED STATES"> <data key="field">Actor2Name_s</data> <data key="level">1</data> </node> <edge id="3" source="UNITED STATES" target="UNITED STATES"/> <edge id="4" source="AFRICA" target="UNITED STATES"/> <edge id="5" source="POLICE" target="UNITED STATES"/>
Description
Please add the ability to export edge labels to the GraphML export API.
In the comment section is the email I sent to solr-users where they suggested adding an issue to request this capability be added - they also said it would be an easy change to make. The change is minor and would possibly be to this class:
org.apache.solr.response.GraphMLResponseWriter or might be an extension to that class.