[ 
https://issues.apache.org/jira/browse/COMMONSRDF-7?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15615284#comment-15615284
 ] 

ASF GitHub Bot commented on COMMONSRDF-7:
-----------------------------------------

Github user stain commented on a diff in the pull request:

    https://github.com/apache/incubator-commonsrdf/pull/26#discussion_r85522921
  
    --- Diff: api/src/main/java/org/apache/commons/rdf/api/RDFTerm.java ---
    @@ -17,14 +17,32 @@
      */
     package org.apache.commons.rdf.api;
     
    +import java.util.List;
    +import java.util.Map;
    +import java.util.Set;
    +
     /**
      * An <a href= "http://www.w3.org/TR/rdf11-concepts/#dfn-rdf-term"; >RDF-1.1
    - * Term</a>, as defined by <a href= "http://www.w3.org/TR/rdf11-concepts/";
    - * >RDF-1.1 Concepts and Abstract Syntax</a>, a W3C Recommendation 
published on
    - * 25 February 2014.<br>
    + * Term</a>, as defined by
    + * <a href= "http://www.w3.org/TR/rdf11-concepts/"; >RDF-1.1 Concepts and
    + * Abstract Syntax</a>, a W3C Recommendation published on 25 February 2014.
    + * <p>
    + * A {@link RDFTerm} represents either an {@link IRI}, a {@link BlankNode} 
or a
    + * {@link Literal}.
    + * <p>
    + * A {@link RDFTerm} object in Commons RDF is considered 
<em>immutable</em>,
    + * that is, over it's life time it will have consistent behaviour for its
    + * {@link #equals(Object)} and {@link #hashCode()}, and objects returned 
from
    + * its getter methods (e.g. {@link IRI#getIRIString()} and
    + * {@link Literal#getLanguageTag()}) will have consistent
    + * {@link #equals(Object)} behaviour.
    + * <p>
    + * Thus, an {@link RDFTerm} is thread-safe and can be safely used in 
collections
    + * like {@link List}, {@link Map} or {@link Set}, and a {@link RDFTerm} 
can be
    --- End diff --
    
    It's not - they are both due to immutability. I split this into multiple 
paragraphs.


> Document that RDFTerm, Triple and Quad are immutable
> ----------------------------------------------------
>
>                 Key: COMMONSRDF-7
>                 URL: https://issues.apache.org/jira/browse/COMMONSRDF-7
>             Project: Apache Commons RDF
>          Issue Type: Improvement
>          Components: api
>            Reporter: Stian Soiland-Reyes (old)
>            Assignee: Stian Soiland-Reyes
>              Labels: discussion, immutable
>             Fix For: 0.3.0
>
>
> From https://github.com/commons-rdf/commons-rdf/issues/57
> ansell:
> {quote}
> As mentioned in #45, should we add a contract requirement that all RDFTerm 
> instances (and Triple?) be implemented as immutable objects?
> https://github.com/commons-rdf/commons-rdf/issues/45
> {quote}
> stain:
> {quote}
> +1, if we say SHOULD. But only the exposed RDFTerm++ methods need to be 
> immutable - so this should probably go into each of their descriptions. So if 
> I have a getDatabaseThingie() method that can be mutable.
> {quote}
> ansell:
> {quote}
> The value of stating that the objects must be immutable is decreased if it 
> only applies to the results of the API methods. A useful goal would be to 
> ensure that the entire object is immutable to give a guarantee about 
> threadsafety, but that may be too much for all implementations to support.
> Just stating that the results of the visible API methods are immutable 
> doesn't help much. It is also not likely to apply to the methods that return 
> Optional, as to enable serialisation, the actual field may not be an Optional 
> itself in most cases.
> {quote}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to