Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Graph format: Refactoring and enhancing #297

Closed
wants to merge 14 commits into from
Closed

Graph format: Refactoring and enhancing #297

wants to merge 14 commits into from

Conversation

gesinn-it-gea
Copy link
Member

This PR is made in reference to: #

This PR addresses or contains:

  • refactored, added SRFGraphNode class
  • added handling for additional labels (label1 - label3)
  • added record/Mrecord type shapes
  • added arrowhead parameter
  • added support for Display Title

This PR includes:

  • Update of RELEASE-NOTES.md
  • Tests (unit/integration)
  • CI build passed

SbstnS and others added 3 commits July 27, 2017 17:09
…abels, added record/Mrecord type shapes, added arrowhead parameter, added support for Display Title
@gesinn-it-gea
Copy link
Member Author

... I'll add a screenhot soon to show, how this new label parameters can be used.

@gesinn-it-gea
Copy link
Member Author

Example Query:

{{#ask:[[Category:Team]][[Part Of Team::+]]
  |?Part Of Team
  |?Display Title=label1
  |?Casted Leadership Role=label2
  |?Casted=label3
  |format=graph
  |arrowhead=none
  |nodeshape=Mrecord
  |graphsize=20,20
  |graphcolor=no
  |graphlink=no
  |graphlabel=no
  |graphlegend=no
  |arrowdirection=BT
}}

@gesinn-it-gea
Copy link
Member Author

srf graph

In the top box, only label1 is used, in bottom left box, all three labels are used, in bottom right box, label1 and label3 are used (used means, that the query had results)

@gesinn-it-gea
Copy link
Member Author

“This PR has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 741782”.

@kghbln kghbln changed the title refactoring and enhaning Graph format Graph format: Refactoring and enhancing Aug 31, 2017
@kghbln kghbln added this to the 3.0.0 milestone Aug 31, 2017
@mwjames
Copy link
Contributor

mwjames commented Sep 9, 2017

I'll be doing only a quick review given that my last comments on SFS went into thin air and I'm pressed with time during my support window.

This PR has received funding from the European Union’s Horizon 2020 research and innovation programme under grant agreement No 741782

Each PR should note the grant agreement so they can be easily distinguishable (given that those grants are created from tax payers money).

Here some initial comments without looking too much at the code itself:

  • One class per file (see SRFGraphNode)
  • Adding a new class -> requires a unit test
  • SRF is namespaced, so newly or refactored classes should carry this characteristic
  • PHP class properties don't require a prefix m_ (see private $m_id;)
  • Ensure explicit visibility ( function __construct( $id ) {)
  • Why does the parameter name change from srf-paramdesc-graphlegend to srf_paramdesc_graphlegend? (In general we want a hyphen as separator, not an underscore)
  • Why do we change from the [ ... ] to array( ... ) as array declaration?

@gesinn-it-gea
Copy link
Member Author

@mwjames uups, obviously something went completely wrong with this PR. Seems that I accidentally merged a wrong branch of the code from our internal gitlab. Also my PHPStorm code formatter has messed up something. I'll double check. Sorry.

@gesinn-it-gea
Copy link
Member Author

@mwjames would you recommend moving the Graph format to an own directory (graph)? Currently it's sharing the graphviz directory with the Process format?

@gesinn-it-gea
Copy link
Member Author

@SchmidDev please do not update this PR with temp. stuff. @mwjames (and others) please ignore latest commits. The whole thing is a complete mess now.

@mwjames
Copy link
Contributor

mwjames commented Sep 16, 2017

would you recommend moving the Graph format to an own directory (graph)

Yes.

CI failures have been fixed with 9769c97.

@mwjames
Copy link
Contributor

mwjames commented Sep 23, 2017

@gesinn-it Are we going to continue this one, would be a shame if steam is running out here!

By the way, I saw something peculiar, the naming of getLabel1, getLabel2, and getLabel3. Either use a more descriptive name or simply use getLabel(...) where it takes an argument and can generate any number of (maybe something like 4 or 5 in future) labels. Having 1,2,3 as name doesn't really appeal to me.

@gesinn-it-gea
Copy link
Member Author

@mwjames yes, we are definitely continue this one. I'm traveling the next two weeks (including SMWCon). I hope I can finish latest during SMWCon...

@mwjames
Copy link
Contributor

mwjames commented Oct 7, 2017

#314 can guide you on the principles of how a refactoring effort can look like.

@gesinn-it-gea
Copy link
Member Author

@mwjames thanks for the hint with #314. I'll have a look at it. I continued this one but still a few things to clean up. Hope to have it ready before next weekend.

@gesinn-it-gea
Copy link
Member Author

GraphNode

I couldn't see any GraphNode unit test (use the standard inheritance
PHPUnit_Framework_TestCase)

Each class is tested on its own which means GraphNode =>
GraphNodeTest (avoid mingling otherwise it becomes some form of an
integration test).

I'll create separate GraphNodeTest.php file

@gesinn-it-gea
Copy link
Member Author

GraphResultPrinter

There are a lot of hard-coded strings like $graphInput .= "[label=\"{" . $label;, is it possible to isolated this in a more
formalized and intelligent formatter class that only deals with the
formatting and once done outputs the final string?

Good idea, I'll create a GraphFormatter class + GraphFormatterTest...

@s7eph4n
Copy link
Contributor

s7eph4n commented Oct 11, 2017

Would it make sense to change the PSR-4 pointer in composer.json to the /formats/ directory instead of creating a /src/ directory for one format?

@mwjames
Copy link
Contributor

mwjames commented Oct 11, 2017 via email

@s7eph4n
Copy link
Contributor

s7eph4n commented Oct 14, 2017

One of my biggest problems when looking for something in the SMW code is that I never know, in which folder to start. Given the structural changes in SMW the "clean slate" approach makes sense, but I think SRF is already structured well enough and any new folder structure will look pretty much the same as the old one.

I would also challenge the other two points. Arranging the project structure to have a tasklist is somewhat similar to putting ToDos and FixMes in the code. If we want a task list we should use a Github issue/project/whatever.

And test coverage or 'refactoring done' as a criterion to move formats to the new folder will probably not work either. I am working on the Filtered format right now. Done some refactoring, but it is still messy. Move over or not? Same goes probably for a number of other formats.

Finally with SRF we are in a situation, where usually a format is worked on when somebody has an issue with it. Given this approach we will end up having the src and formats folders side by side forever because some zombie formats will never get cleaned up.

So, I would suggest

  1. Moving all formats to src (or what about src/Formats?)
  2. Creating a Rework project on Github
  3. If possible removing the unused, unmaintained formats

@mwjames
Copy link
Contributor

mwjames commented Oct 14, 2017

Moving the discussion about refactoring in general to #321.

@mwjames
Copy link
Contributor

mwjames commented Oct 21, 2017

commented 11 days ago

@gesinn-it Any update?

@mwjames
Copy link
Contributor

mwjames commented Nov 4, 2017

This PR is open since Aug 31, and we still have some unresolved issues. Do we expect an update in near future?

@gesinn-it-gea
Copy link
Member Author

@mwjames: I'm very busy with projects at the moment. I will definitely need some days to do the changes you have suggested. No worries that this PR dies, because I need the changes to the graph format myself ;-)

@mwjames
Copy link
Contributor

mwjames commented Jan 6, 2018

If this ever gets completed, please see #365.

@mwjames
Copy link
Contributor

mwjames commented Jul 29, 2018

@RacoonDev
manage invalid offset of label
c0afa5d

Please make sure you use the master (see section "Conflicting files") as base, furthermore please DO NOT change the composer to something like:

@RacoonDev
change semantic mediawiki version because of dependency problems
44fc73c

Master works against master and against a restricted branch like "~2.5.3".

@kghbln kghbln modified the milestones: 3.0.0, 3.1.0 Oct 10, 2018
@kghbln kghbln removed this from the 3.1.0 milestone Jun 12, 2019
@mwjames
Copy link
Contributor

mwjames commented Jul 21, 2019

@kghbln @hexmode @krabina @gesinn-it @RacoonDev This PR has been stuck here for nearly two years and I'm wondering whether we can resurrect this change and finalize it, otherwise we need to close it.

Also, as indicate above I expect that people committed to a PR do finalize it in an appropriate amount of time. Please consider this as a topic for discussion among yourself for the next SMWCon about how to improve contributions and what is needed to make them an actually contribution to the overall SMW community.

Note

An epic task of refactoring should be split into smaller pieces making room for early adaptions without necessarily impairing existing functionality.

@mwjames
Copy link
Contributor

mwjames commented Jul 21, 2019

As for "added support for Display Title" see #496 which was merged prior given the unknown state of this PR.

@gesinn-it-gea
Copy link
Member Author

@mwjames this PR really got stuck. Development progressed somewhat bumpy between branching 3.0 and general refactoring. In the meanwhile, the code base of SRF has evolved. I think we should consider closing this PR and re-implement on current code base... The gesinn.it team could do this job during the next weeks.

@mwjames
Copy link
Contributor

mwjames commented Jul 22, 2019 via email

@SbstnS
Copy link
Contributor

SbstnS commented Sep 6, 2019

@JeroenDeDauw could you please close this PR.
Thanks!

@kghbln kghbln closed this Sep 6, 2019
@kghbln
Copy link
Member

kghbln commented Sep 6, 2019

could you please close this PR.

Done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants