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

Henry Story commented on CLEREZZA-510:
--------------------------------------

I put it in 

   
./rdf.scala.utils/src/main/scala/org/apache/clerezza/rdf/scala/utils/EasyGraph.scala

because I am starting to need it in other packages, not just the test package.

Some issues I have thought of when building and using this (usage helps the 
most in understanding)

  1. It could be merged with SimpleGraphNode
      (but I thought it would be better to do that, when this class is well 
understood, as I don't want to by accident make Simple complex)
  2. It coud be more efficient. EasyGraph could have lazy val references to 
instances of the inner Predicate and InversePredicate classes
      which would have var references to the UriRefs that identify them, so 
that it does not need to create a new object on every statement creation. This 
would restrict the writing of such graph to a single threads
      though.
  3. one should look at using -- and --> perhaps for arrows, and so also <-- 
and -- for reverse arrows, as those are easier to type, and available on more 
platforms. On the other hand one has to watch out about operator precedence 
rules. From the Scala Reference book
    <blockquote>
      The precedence of an infix operator is determined by the operator’s first 
character.
      Characters are listed below in increasing order of precedence, with 
characters on
      the same line having the same precedence.
              (all letters)
               |
               ^
              &
              < > 
              = !
              :
             + *
             / %
           (all other special characters)

    That is, operators starting with a letter have lowest precedence, followed 
by operators
    starting with ‘|’, etc. 
    There’s one exception to this rule, which concerns assignment 
operators(§6.12.4).
    The precedence of an assigment operator is the same as the one of simple 
assignment
    (=). That is, it is lower than the precedence of any other operator.
    The associativity of an operator is determined by the operator’s last 
character. Operators
    ending in a colon ‘:’ are right-associative. All other operators are 
leftassociative.
</blockquote>
    
    4. If one is to use unicode symbols, there may be more appropriate ones 
that I have not noticed.
  

> DSL for writing RDF elegantly
> -----------------------------
>
>                 Key: CLEREZZA-510
>                 URL: https://issues.apache.org/jira/browse/CLEREZZA-510
>             Project: Clerezza
>          Issue Type: New Feature
>            Reporter: Henry Story
>            Assignee: Henry Story
>         Attachments: NiceLookingGraphInScala.png
>
>
> Writing RDF like 
> graph.add(new TripleImp(Subj,rel,obj))
> is tedious to read and to write and makes every thing seem really heavy. Make 
> it look good.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to