Re: Re: density of GraphUtil not recognized

2022-12-11 Thread Lorenz Buehmann

Made my day ...

StackOverflow is already disallowing ChatGPT comments ...


there are of course tools for graph measures beyond Jena, e.g. you could 
use Python rdflib which allows for converting the graph to a  networkx 
graph which in fact is a standard API for network analytics.


Or you use Apache Jena, convert the Jena model to a JGraphT directed 
pseudo graph [1] and use  JGraphT methods resp. its extensions


[1] 
https://jgrapht.org/javadoc/org.jgrapht.core/org/jgrapht/graph/DirectedPseudograph.html


On 11.12.22 19:43, emri mbiemri wrote:

The ChatGPT suggested using these kinds of solutions for getting some of
the above-mentioned graph metrics.
Anyway, is there any other tool that calculated some graph metrics on RDF
graphs?

On Sun, Dec 11, 2022 at 8:13 PM Andy Seaborne  wrote:



On 11/12/2022 13:15, emri mbiemri wrote:

ok, thanks, but is there any function within Apache Jena that calculates
the graph metrics such as centrality, density, and clustering

coefficient?

No.

What led you to thinking there was?

 Andy



Re: density of GraphUtil not recognized

2022-12-11 Thread Marco Neumann
oh well...

On Sun, Dec 11, 2022 at 6:44 PM emri mbiemri 
wrote:

> The ChatGPT suggested using these kinds of solutions for getting some of
> the above-mentioned graph metrics.
> Anyway, is there any other tool that calculated some graph metrics on RDF
> graphs?
>
> On Sun, Dec 11, 2022 at 8:13 PM Andy Seaborne  wrote:
>
> >
> >
> > On 11/12/2022 13:15, emri mbiemri wrote:
> > > ok, thanks, but is there any function within Apache Jena that
> calculates
> > > the graph metrics such as centrality, density, and clustering
> > coefficient?
> >
> > No.
> >
> > What led you to thinking there was?
> >
> > Andy
> >
>


-- 


---
Marco Neumann


Re: density of GraphUtil not recognized

2022-12-11 Thread Andy Seaborne




On 11/12/2022 18:43, emri mbiemri wrote:

The ChatGPT suggested using these kinds of solutions for getting some of
the above-mentioned graph metrics.


Did it say "Jena"?


Anyway, is there any other tool that calculated some graph metrics on RDF
graphs?


Try a Google search.

Andy


On Sun, Dec 11, 2022 at 8:13 PM Andy Seaborne  wrote:




On 11/12/2022 13:15, emri mbiemri wrote:

ok, thanks, but is there any function within Apache Jena that calculates
the graph metrics such as centrality, density, and clustering

coefficient?

No.

What led you to thinking there was?

 Andy





Re: density of GraphUtil not recognized

2022-12-11 Thread emri mbiemri
The ChatGPT suggested using these kinds of solutions for getting some of
the above-mentioned graph metrics.
Anyway, is there any other tool that calculated some graph metrics on RDF
graphs?

On Sun, Dec 11, 2022 at 8:13 PM Andy Seaborne  wrote:

>
>
> On 11/12/2022 13:15, emri mbiemri wrote:
> > ok, thanks, but is there any function within Apache Jena that calculates
> > the graph metrics such as centrality, density, and clustering
> coefficient?
>
> No.
>
> What led you to thinking there was?
>
> Andy
>


Re: density of GraphUtil not recognized

2022-12-11 Thread Andy Seaborne




On 11/12/2022 13:15, emri mbiemri wrote:

ok, thanks, but is there any function within Apache Jena that calculates
the graph metrics such as centrality, density, and clustering coefficient?


No.

What led you to thinking there was?

Andy


Re: density of GraphUtil not recognized

2022-12-11 Thread emri mbiemri
ok, thanks, but is there any function within Apache Jena that calculates
the graph metrics such as centrality, density, and clustering coefficient?

On Sun, Dec 11, 2022 at 2:17 PM Andy Seaborne  wrote:

>
>
> On 11/12/2022 11:53, emri mbiemri wrote:
> > Hi Andy, thanks for the reply!
> >
> > What about the GraphUtil.density() function, any idea why it is not
> > recognized?
>
> because it is not in the Jena codebase (nor has it ever been in the
> codebase).
>
>
> https://github.com/apache/jena/blob/main/jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java
>
> Why do you think it would be there?
>
> > Concerning the RDF4J I think it includes all the relevant
> > apache jena jars.
>
> I would very surprised if it did.
>
> You can check:
> https://github.com/eclipse/rdf4j/
>
>  Andy
>
> >
> > On Sun, Dec 11, 2022 at 12:31 PM Andy Seaborne  wrote:
> >
> >>
> >>
> >> On 11/12/2022 10:17, emri mbiemri wrote:
> >>> Dear community, I am trying to get some graph metrics using Apache
> >>> Jena's GraphUtil. But  some functions like "density" of GraphUtil
> cannot
> >> be
> >>> recognized, or the package org.apache.jena.graph.Centrality cannot be
> >>> resolved.
> >>
> >> There is no org.apache.jena.graph.Centrality
> >>
> >>> I am using Eclipse, my apache jena version is 3.14.0 within the
> >>> rdf4j depencey:
> >>>org.eclipse.rdf4j
> >>> rdf4j-storage
> >>> 3.5.0
> >>
> >> Different tool kit!
> >>
> >> org.eclipse.rdf4j artifacts come from the Eclipse Foundation project
> RDF4J
> >>
> >> https://rdf4j.org/
> >>
> >> (This is not related to whether you use the Eclipse IDE)
> >>
> >>>
> >>> Any idea why some of the artifacts cannot be found?
> >>>
> >>
> >>   Andy
> >>
> >
>


Re: density of GraphUtil not recognized

2022-12-11 Thread Andy Seaborne




On 11/12/2022 11:53, emri mbiemri wrote:

Hi Andy, thanks for the reply!

What about the GraphUtil.density() function, any idea why it is not
recognized?


because it is not in the Jena codebase (nor has it ever been in the 
codebase).


https://github.com/apache/jena/blob/main/jena-core/src/main/java/org/apache/jena/graph/GraphUtil.java

Why do you think it would be there?


Concerning the RDF4J I think it includes all the relevant
apache jena jars.


I would very surprised if it did.

You can check:
https://github.com/eclipse/rdf4j/

Andy



On Sun, Dec 11, 2022 at 12:31 PM Andy Seaborne  wrote:




On 11/12/2022 10:17, emri mbiemri wrote:

Dear community, I am trying to get some graph metrics using Apache
Jena's GraphUtil. But  some functions like "density" of GraphUtil cannot

be

recognized, or the package org.apache.jena.graph.Centrality cannot be
resolved.


There is no org.apache.jena.graph.Centrality


I am using Eclipse, my apache jena version is 3.14.0 within the
rdf4j depencey:
   org.eclipse.rdf4j
rdf4j-storage
3.5.0


Different tool kit!

org.eclipse.rdf4j artifacts come from the Eclipse Foundation project RDF4J

https://rdf4j.org/

(This is not related to whether you use the Eclipse IDE)



Any idea why some of the artifacts cannot be found?



  Andy





Re: density of GraphUtil not recognized

2022-12-11 Thread emri mbiemri
Hi Andy, thanks for the reply!

What about the GraphUtil.density() function, any idea why it is not
recognized? Concerning the RDF4J I think it includes all the relevant
apache jena jars.

On Sun, Dec 11, 2022 at 12:31 PM Andy Seaborne  wrote:

>
>
> On 11/12/2022 10:17, emri mbiemri wrote:
> > Dear community, I am trying to get some graph metrics using Apache
> > Jena's GraphUtil. But  some functions like "density" of GraphUtil cannot
> be
> > recognized, or the package org.apache.jena.graph.Centrality cannot be
> > resolved.
>
> There is no org.apache.jena.graph.Centrality
>
> > I am using Eclipse, my apache jena version is 3.14.0 within the
> > rdf4j depencey:
> >   org.eclipse.rdf4j
> > rdf4j-storage
> > 3.5.0
>
> Different tool kit!
>
> org.eclipse.rdf4j artifacts come from the Eclipse Foundation project RDF4J
>
> https://rdf4j.org/
>
> (This is not related to whether you use the Eclipse IDE)
>
> >
> > Any idea why some of the artifacts cannot be found?
> >
>
>  Andy
>


Re: density of GraphUtil not recognized

2022-12-11 Thread Andy Seaborne




On 11/12/2022 10:17, emri mbiemri wrote:

Dear community, I am trying to get some graph metrics using Apache
Jena's GraphUtil. But  some functions like "density" of GraphUtil cannot be
recognized, or the package org.apache.jena.graph.Centrality cannot be
resolved.


There is no org.apache.jena.graph.Centrality


I am using Eclipse, my apache jena version is 3.14.0 within the
rdf4j depencey:
  org.eclipse.rdf4j
rdf4j-storage
3.5.0


Different tool kit!

org.eclipse.rdf4j artifacts come from the Eclipse Foundation project RDF4J

https://rdf4j.org/

(This is not related to whether you use the Eclipse IDE)



Any idea why some of the artifacts cannot be found?



Andy


Re: RDF-star and Lists in Quoted Triples

2022-12-11 Thread Andy Seaborne




On 11/12/2022 08:32, Adam Sobieski wrote:

Hello. While exploring Jena (v4.6.1)'s RDF-star functionality and features, I'm 
getting the following output:


@prefix calculus:  .
@prefix example:   .
@prefix rdf:   .
@prefix xsd:   .

<< example:predicate calculus:holdsFor _:b0 >>
 calculus:probability  "0.95"^^xsd:double .

[ rdf:first example:x ; rdf:rest ( example:y example:z ) ] .


That's a (fixable) bug : it should be:

_:b0 rdf:first example:x ; rdf:rest ( example:y example:z ) .

>  RDFDataMgr.write(System.out, model, Lang.TURTLE);

Workaround: Use RDFFormat.TURTLE_BLOCKS instead of Lang.TURTLE.

Or N-Triples or RDFFormat.TURTLE_FLAT (N-triple using prefixes)


while expecting:


@prefix calculus:  .
@prefix example:   .
@prefix rdf:   .
@prefix xsd:   .

<< example:predicate calculus:holdsFor ( example:x example:y example:z ) >>
 calculus:probability  "0.95"^^xsd:double .


That is illegal syntax.

The syntax for quoted triples does not allow list syntax.

https://www.w3.org/2021/12/rdf-star.html#turtle-star-grammar

The best you can do is put the blank node of the first cons cell of the 
list in the quoted triple but the triples rest will be asserted.


The fact it's illegal is why RIOT is trying to write the list separately.

Andy




To obtain the output, I'm utilizing the following source code:

public static void foo(Model model)
{
   model.setNsPrefix("calculus", 
"http://www.w3.org/community/planning/calculus/ontology#;);
   model.setNsPrefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#;);
   model.setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#;);
   model.setNsPrefix("example", "http://example.org/#;);

   Resource predicate = model.createResource("http://example.org/#predicate;);
   Resource p1 = model.createResource("http://example.org/#x;);
   Resource p2 = model.createResource("http://example.org/#y;);
   Resource p3 = model.createResource("http://example.org/#z;);

   Property calculus_holdsFor = 
model.createProperty("http://www.w3.org/community/planning/calculus/ontology#holdsFor;);
   Property calculus_probability = 
model.createProperty("http://www.w3.org/community/planning/calculus/ontology#probability;);
   
   RDFList list = model.createList(p1, p2, p3);
   Statement s = model.createStatement(predicate, calculus_holdsFor, list);
   Resource quoted = model.createResource(s);
   
   //model.add(s);
   model.add(quoted, calculus_probability, model.createTypedLiteral(0.95));
}
  
public static void main(String[] args) throws IOException
{
   Model model = ModelFactory.createDefaultModel();
   foo(model);   

   RDFDataMgr.write(System.out, model, Lang.TURTLE);
}

Might this be a bug or issue with respect to list-handling in quoted RDF-star 
triples or with respect to serialization to Turtle-star? Thank you.


Best regards,
Adam Sobieski



density of GraphUtil not recognized

2022-12-11 Thread emri mbiemri
Dear community, I am trying to get some graph metrics using Apache
Jena's GraphUtil. But  some functions like "density" of GraphUtil cannot be
recognized, or the package org.apache.jena.graph.Centrality cannot be
resolved. I am using Eclipse, my apache jena version is 3.14.0 within the
rdf4j depencey:
 org.eclipse.rdf4j
rdf4j-storage
3.5.0

Any idea why some of the artifacts cannot be found?


RDF-star and Lists in Quoted Triples

2022-12-11 Thread Adam Sobieski
Hello. While exploring Jena (v4.6.1)'s RDF-star functionality and features, I'm 
getting the following output:


@prefix calculus:  .
@prefix example:   .
@prefix rdf:   .
@prefix xsd:   .

<< example:predicate calculus:holdsFor _:b0 >>
calculus:probability  "0.95"^^xsd:double .

[ rdf:first example:x ; rdf:rest ( example:y example:z ) ] .


while expecting:


@prefix calculus:  .
@prefix example:   .
@prefix rdf:   .
@prefix xsd:   .

<< example:predicate calculus:holdsFor ( example:x example:y example:z ) >>
calculus:probability  "0.95"^^xsd:double .


To obtain the output, I'm utilizing the following source code:

public static void foo(Model model)
{
  model.setNsPrefix("calculus", 
"http://www.w3.org/community/planning/calculus/ontology#;);
  model.setNsPrefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#;);
  model.setNsPrefix("xsd", "http://www.w3.org/2001/XMLSchema#;);
  model.setNsPrefix("example", "http://example.org/#;);

  Resource predicate = model.createResource("http://example.org/#predicate;);
  Resource p1 = model.createResource("http://example.org/#x;);
  Resource p2 = model.createResource("http://example.org/#y;);
  Resource p3 = model.createResource("http://example.org/#z;);

  Property calculus_holdsFor = 
model.createProperty("http://www.w3.org/community/planning/calculus/ontology#holdsFor;);
  Property calculus_probability = 
model.createProperty("http://www.w3.org/community/planning/calculus/ontology#probability;);
  
  RDFList list = model.createList(p1, p2, p3);
  Statement s = model.createStatement(predicate, calculus_holdsFor, list);
  Resource quoted = model.createResource(s);
  
  //model.add(s);
  model.add(quoted, calculus_probability, model.createTypedLiteral(0.95));
}
  
public static void main(String[] args) throws IOException
{
  Model model = ModelFactory.createDefaultModel();
  foo(model);   

  RDFDataMgr.write(System.out, model, Lang.TURTLE);
}

Might this be a bug or issue with respect to list-handling in quoted RDF-star 
triples or with respect to serialization to Turtle-star? Thank you.


Best regards,
Adam Sobieski