You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jena.apache.org by emri mbiemri <em...@gmail.com> on 2022/01/18 16:32:16 UTC

Trasforming and quering RDFs

Dears,

In order to have a more scalable knowledge base and easy to query, I have
converted JSON files [1] to RDFgraphs [2]. I am trying to get
all "Datatype" from "ViewModel" which has a "Type":1. The issue is I cannot
find the Type: 1 within the RDF file and if so, I don't know how to query
the "Datatype" which has "Type":1 within the "ViewModel" tag?

And secondly, is there a direct way to query the JSON files easier using
SPARQL without having to convert them into RDF?

Hope for your help.


[1] https://github.com/iliriani/iliriangit/blob/master/CustomerForm.json
[2] https://github.com/iliriani/iliriangit/blob/master/CustomerForm.rdf

Re: Trasforming and quering RDFs

Posted by emri mbiemri <em...@gmail.com>.
Hi, Yes that's the query I liked, I found it also when I initially get all
the predicates that has Type and DataType, then I just narrowed the results
and came to the same query. Thanks a lot.

On Tue, Jan 18, 2022 at 11:42 PM Martynas Jusevičius <ma...@atomgraph.com>
wrote:

> As for the query, you need to stop thinking in nested objects and
> start thinking in triples.
>
> Could the query be something like this?
>
> SELECT  ?s ?datatype
> WHERE
>   { ?s  <https://schema.org/Type>  1 ;
>         <https://schema.org/Datatype>  ?datatype
>   }
>
> You can try it on your data on sparql.org: https://bit.ly/3nBQKnr
>
> On Tue, Jan 18, 2022 at 10:03 PM Rinor Sefa <ri...@uzh.ch> wrote:
> >
> > Hey,
> >
> > Regarding your problem "I can't find X in the RDF file". In your
> example, the RDF file is in XML format, which may not be ideal for user
> reading. Why don't you try to present the RDF in more readable formats such
> as N3 or Turtle?
> >
> > Rinor Sefa
> >
> > -----Original Message-----
> > From: Martynas Jusevičius <ma...@atomgraph.com>
> > Sent: Tuesday, 18 January 2022 17:38
> > To: jena-users-ml <us...@jena.apache.org>
> > Subject: Re: Trasforming and quering RDFs
> >
> > Hi,
> >
> > SPARQL is an RDF query language, so no.
> >
> > But there are tools that can help:
> > https://github.com/AtomGraph/JSON2RDF
> > https://sparql-anything.cc
> >
> >
> > Martynas
> > atomgraph.com
> >
> > On Tue, Jan 18, 2022 at 5:32 PM emri mbiemri <em...@gmail.com>
> wrote:
> > >
> > > Dears,
> > >
> > > In order to have a more scalable knowledge base and easy to query, I
> > > have converted JSON files [1] to RDFgraphs [2]. I am trying to get all
> > > "Datatype" from "ViewModel" which has a "Type":1. The issue is I
> > > cannot find the Type: 1 within the RDF file and if so, I don't know
> > > how to query the "Datatype" which has "Type":1 within the "ViewModel"
> tag?
> > >
> > > And secondly, is there a direct way to query the JSON files easier
> > > using SPARQL without having to convert them into RDF?
> > >
> > > Hope for your help.
> > >
> > >
> > > [1]
> > > https://github.com/iliriani/iliriangit/blob/master/CustomerForm.json
> > > [2]
> > > https://github.com/iliriani/iliriangit/blob/master/CustomerForm.rdf
>

Re: Trasforming and quering RDFs

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
As for the query, you need to stop thinking in nested objects and
start thinking in triples.

Could the query be something like this?

SELECT  ?s ?datatype
WHERE
  { ?s  <https://schema.org/Type>  1 ;
        <https://schema.org/Datatype>  ?datatype
  }

You can try it on your data on sparql.org: https://bit.ly/3nBQKnr

On Tue, Jan 18, 2022 at 10:03 PM Rinor Sefa <ri...@uzh.ch> wrote:
>
> Hey,
>
> Regarding your problem "I can't find X in the RDF file". In your example, the RDF file is in XML format, which may not be ideal for user reading. Why don't you try to present the RDF in more readable formats such as N3 or Turtle?
>
> Rinor Sefa
>
> -----Original Message-----
> From: Martynas Jusevičius <ma...@atomgraph.com>
> Sent: Tuesday, 18 January 2022 17:38
> To: jena-users-ml <us...@jena.apache.org>
> Subject: Re: Trasforming and quering RDFs
>
> Hi,
>
> SPARQL is an RDF query language, so no.
>
> But there are tools that can help:
> https://github.com/AtomGraph/JSON2RDF
> https://sparql-anything.cc
>
>
> Martynas
> atomgraph.com
>
> On Tue, Jan 18, 2022 at 5:32 PM emri mbiemri <em...@gmail.com> wrote:
> >
> > Dears,
> >
> > In order to have a more scalable knowledge base and easy to query, I
> > have converted JSON files [1] to RDFgraphs [2]. I am trying to get all
> > "Datatype" from "ViewModel" which has a "Type":1. The issue is I
> > cannot find the Type: 1 within the RDF file and if so, I don't know
> > how to query the "Datatype" which has "Type":1 within the "ViewModel" tag?
> >
> > And secondly, is there a direct way to query the JSON files easier
> > using SPARQL without having to convert them into RDF?
> >
> > Hope for your help.
> >
> >
> > [1]
> > https://github.com/iliriani/iliriangit/blob/master/CustomerForm.json
> > [2]
> > https://github.com/iliriani/iliriangit/blob/master/CustomerForm.rdf

RE: Trasforming and quering RDFs

Posted by Rinor Sefa <ri...@uzh.ch>.
Hey,

Regarding your problem "I can't find X in the RDF file". In your example, the RDF file is in XML format, which may not be ideal for user reading. Why don't you try to present the RDF in more readable formats such as N3 or Turtle? 

Rinor Sefa

-----Original Message-----
From: Martynas Jusevičius <ma...@atomgraph.com> 
Sent: Tuesday, 18 January 2022 17:38
To: jena-users-ml <us...@jena.apache.org>
Subject: Re: Trasforming and quering RDFs

Hi,

SPARQL is an RDF query language, so no.

But there are tools that can help:
https://github.com/AtomGraph/JSON2RDF
https://sparql-anything.cc


Martynas
atomgraph.com

On Tue, Jan 18, 2022 at 5:32 PM emri mbiemri <em...@gmail.com> wrote:
>
> Dears,
>
> In order to have a more scalable knowledge base and easy to query, I 
> have converted JSON files [1] to RDFgraphs [2]. I am trying to get all 
> "Datatype" from "ViewModel" which has a "Type":1. The issue is I 
> cannot find the Type: 1 within the RDF file and if so, I don't know 
> how to query the "Datatype" which has "Type":1 within the "ViewModel" tag?
>
> And secondly, is there a direct way to query the JSON files easier 
> using SPARQL without having to convert them into RDF?
>
> Hope for your help.
>
>
> [1] 
> https://github.com/iliriani/iliriangit/blob/master/CustomerForm.json
> [2] 
> https://github.com/iliriani/iliriangit/blob/master/CustomerForm.rdf

Re: Trasforming and quering RDFs

Posted by Martynas Jusevičius <ma...@atomgraph.com>.
Hi,

SPARQL is an RDF query language, so no.

But there are tools that can help:
https://github.com/AtomGraph/JSON2RDF
https://sparql-anything.cc


Martynas
atomgraph.com

On Tue, Jan 18, 2022 at 5:32 PM emri mbiemri <em...@gmail.com> wrote:
>
> Dears,
>
> In order to have a more scalable knowledge base and easy to query, I have
> converted JSON files [1] to RDFgraphs [2]. I am trying to get
> all "Datatype" from "ViewModel" which has a "Type":1. The issue is I cannot
> find the Type: 1 within the RDF file and if so, I don't know how to query
> the "Datatype" which has "Type":1 within the "ViewModel" tag?
>
> And secondly, is there a direct way to query the JSON files easier using
> SPARQL without having to convert them into RDF?
>
> Hope for your help.
>
>
> [1] https://github.com/iliriani/iliriangit/blob/master/CustomerForm.json
> [2] https://github.com/iliriani/iliriangit/blob/master/CustomerForm.rdf