GitHub user stain opened a pull request:
https://github.com/apache/incubator-commonsrdf/pull/10
COMMONSRDF-6 Simplify BlankNode.internalIdentifier
An attempt to improve COMMONSRDF-6 by making
`BlankNode.internalIdentifier()` contract generic, e.g. remove
implementation-specifics such as salts.
_As GitHub pull request email sync to Apache seems to not be very stable at
the moment - leave comments on
[COMMONSRDF-6](https://issues.apache.org/jira/browse/COMMONSRDF-6) in Jira
rather than in the GitHub UI_
This keeps the "MUST be universally unique"
aspect with a recommendation to have a UUID included,
so that `internalIdentifier()` has a more well-defined
purpose.
`simple/` updated accordingly to ensure universally unique
UUID string, and hence now passes in `java.util.UUID` from the factory
rather than using `Objects.identityHashCode()`.
As it might be easier to inspect the resulting JavaDoc, rather than the
diffs, I have generated:
http://stain.github.io/incubator-commonsrdf/COMMONSRDF-6/org/apache/commons/rdf/api/RDFTermFactory.html#createBlankNode--
http://stain.github.io/incubator-commonsrdf/COMMONSRDF-6/org/apache/commons/rdf/api/BlankNode.html
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/stain/incubator-commonsrdf
COMMONSRDF-6-internalidentifier
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/incubator-commonsrdf/pull/10.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #10
----
commit 28f92188e02b97ed87f28d783fdf524f03a883ec
Author: Stian Soiland-Reyes <[email protected]>
Date: 2015-04-21T09:51:59Z
COMMONSRDF-6 Make BlankNode.internalIdentifier generic
.. e.g. remove implementation-specifics such as
salts.
This keeps the "MUST be universally unique"
aspect with a recommendation to have a UUID included,
so that internalIdentifier() has a more well-defined
purpose.
commit 367d7305f729ff786d7f77f663750633582153b4
Author: Stian Soiland-Reyes <[email protected]>
Date: 2015-04-23T00:35:01Z
COMMONSRDF-6 Simplify internalIdentifier salts
BlankNodeImpl constructor take a UUID as salt, which is created for each
SimpleRDFTermFactory instance. SimpleRDFTermFactory keeps a random
UUIDv4 per instance for this purpose.
(This may not be effective if loads of factories are made, but this is
the simple implementation which is not required to be pre-emptively
efficient.)
Constructor BlankNodeImpl() without arguments still uses an
internal AtomicLong, now combined with an internal UUID salt.
This could in theory just do
this.id = UUID.randomUUID().toString()
and not keep any counter, but it is much more conceivable that say
10.000 BlankNodeImpls will be made, than 10.000 SimpleRDFTermFactories.
I did not do any performance testing, but kept the AtomicLong mechanism
as I didn't feel a need to change it now.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---