Thanks Andrea for the help!
For graph generation I mean that I'd like to materialize subgraphs of my
overall knowledge starting from some root nodes whose rdf type is of
interest (something similar to what JSON-LD does). Is that clear?
On Mar 22, 2015 1:09 PM, "Andra Lungu" <lungu.an...@gmail.com> wrote:

> Hi Flavio,
>
> We don't have a specific example for generating RDF graphs using Gelly, but
> I will try to drop some lines of code here and hope you will find them
> useful.
>
> An RDF statement is formed of Subject - Predicate - Object triples. In Edge
> notation, the Subject and the Object will be the source and target vertices
> respectively, while the edge value will be the predicate.
>
> This being said, say you have an input plain text file that represents the
> edges.
> A line would look like this : http://test/Frank, marriedWith,
> http://test/Mary
>
> This is internally coded in Flink like a Tuple3. So, to read this edge file
> you should have something like this:
>
> private static DataSet<Edge<String, String>>
> getEdgesDataSet(ExecutionEnvironment env) {
>    if (fileOutput) {
>       return env.readCsvFile(edgesInputPath)
>             .lineDelimiter("\n")
>
>             // the subject, predicate, object
>
>             .types(String.class, String.class, String.class)
>             .map(new MapFunction<Tuple3<String, String, String>,
>                                                       Edge<String,
> String>>() {
>
>                @Override
>                public Edge<String, String> map(Tuple3<String, String,
> String> tuple3) throws Exception {
>                   return new Edge(tuple3.f0, tuple3.f2, tuple3.f1);
>                }
>             });
>    } else {
>       return getDefaultEdges(env);
>    }
> }
>
> After you have this, in your main method, you just write:
> Graph<Long, String, String> rdfGraph = Graph.fromDataSet(edges, env);
>
> I picked up the conversation later on, not sure if that's what you meant by
> "graph generation"...
>
> Cheers,
> Andra
>
> On Sun, Mar 22, 2015 at 12:42 PM, Flavio Pompermaier <pomperma...@okkam.it
> >
> wrote:
>
> > Is there anu example about rdf graph generation based on a skeleton
> > structure?
> > On Mar 22, 2015 12:28 PM, "Fabian Hueske" <fhue...@gmail.com> wrote:
> >
> > > Hi Flavio,
> > >
> > > also, Gelly is a superset of Spargel. It provides the same features and
> > > much more.
> > >
> > > Since RDF is graph-structured, Gelly might be a good fit for your use
> > case.
> > >
> > > Cheers, Fabian
> > >
> >
>

Reply via email to