title: How Programmatically can I Compute Path Length by Injecting numerical value to a node in an RDF Graph Using Jena Ontology API?
body: <p>Building from the previous asked question (<a href="https://stackoverflow.com/questions/17868524/how-can-i-programmatically-compute-path-length-using-jena-rdf-ontology-api?lq=1">How can I programmatically compute path length using Jena RDF/Ontology API?</a>), I need to multiply a numerical value (e.g. 3.5) to one of the specific class (its class size as detailed in the previous question) and be able to compute the overall path length(s) in an RDF Graph. Note that each path that fall-under this specific node will produce a new path weight result. </p>
  
  <p>What I tried to do is to create a method called <code>nValue</code> and passed to it the <code>classSize</code> and the this numerical value variable then added it to the <code>pathSize</code> method for computing the <code>pathLength</code>, the method is as follows: </p>
  
  
  
  <pre class="lang-java prettyprint-override"><code>public static double nValue (int classWeight, double nv )
  {
    double numValue = classWeight*nv;
    if ( nv &lt; 1 ){
      numValue = 1.0;
    }
    return numValue;
  } 
  </code></pre>
  
  <p>Then tried to call this method in the <code>pathSize</code> method to vain. My problem is that I'm new to Jena. So I have a problem in getting a single class in an RDF graph and perform the multiplications to it and combine it to the <code>pathLength</code> computation.</p>