Syncleus / Ferma

An ORM / OGM for the TinkerPop graph stack.
http://syncleus.com/Ferma
Apache License 2.0
136 stars 26 forks source link

Fixed a bug that caused exceptions in the case of a vertex property with a cardinality other than single #41

Closed jsight closed 6 years ago

jsight commented 6 years ago

Currently, if a vertex has a property whose cardinality is "list" or "set", this will result in an exception during element.toString(). This is because abstractvertexframe calls "vertex.property(key)" which will throw an exception if there is more than one result.

This PR works around the issue by returning a List in the case where a property has more than one value. Ideally, this would actually check the cardinality, but there are some limitations in tinkerpop which make it impossible to do that with certainty. The only 100% reliable way to introspect it (that I know of) is to use "properties()" and check the result. :(

At least there are no exceptions now, though. Also, a test is added that will fail without this patch.

codecov[bot] commented 6 years ago

Codecov Report

Merging #41 into master will decrease coverage by 0.24%. The diff coverage is 70.83%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master      #41      +/-   ##
============================================
- Coverage     84.86%   84.61%   -0.25%     
- Complexity      452      457       +5     
============================================
  Files            31       31              
  Lines          1407     1430      +23     
  Branches        283      289       +6     
============================================
+ Hits           1194     1210      +16     
- Misses           70       73       +3     
- Partials        143      147       +4
Impacted Files Coverage Δ Complexity Δ
...n/java/com/syncleus/ferma/AbstractVertexFrame.java 89.6% <70.83%> (-4.52%) 50 <4> (+5)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 3fc3931...ce9e7d0. Read the comment docs.

freemo commented 6 years ago

@jsight approved thanks

jsight commented 6 years ago

Thanks!

On Tue, Jan 16, 2018 at 6:37 PM, Jeffrey Phillips Freeman < notifications@github.com> wrote:

Merged #41 https://github.com/Syncleus/Ferma/pull/41.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Syncleus/Ferma/pull/41#event-1427271298, or mute the thread https://github.com/notifications/unsubscribe-auth/ABIHbR9PlGznIK8pgp2ICBlGvtvrhudSks5tLTK_gaJpZM4RWwBF .