I misunderstood about Model.createResource().
So, I changed the source to which you guess, and then the program worked well.
Thanks a lot!

(2013年11月08日 10:24), Holger Knublauch wrote:
In those lines

             Resource rsrc = model.createResource();
             org.topbraid.spin.model.Query query =
SPINFactory.asQuery(rsrc);   // This function always returns null.

you are first creating a new Resource which has no triples attached to
it, and then try to convert it to a Query. This is not how it will work.
You need to find an existing instance of sp:Select from your Model, e.g.
using

StmtIterator it = model.listStatements(null, RDF.type, SP.Select);
while(it.hasNext()) {
     Resource rsrc = it.next().getSubject();
     ....
}

HTH
Holger



On 11/8/2013 11:20, [email protected] wrote:
Hi Holger,

I got it.
I attached the source code.

Thanks,
Ryo

2013?11?8???? 9?59?29? UTC+9 Holger Knublauch:

    Hi Ryo,

    sorry I cannot see what would be wrong. I would need a complete
    example (Java code) to reproduce this.

    Regards,
    Holger


    On 11/8/2013 10:38, [email protected] <javascript:> wrote:
    Hi Holger,

    The rdf:types of the resource is http://spinrdf.org/sp#Select
    <http://spinrdf.org/sp#Select> .

    Thanks,
    Ryo
    2013?11?6???? 13?45?20? UTC+9 Holger Knublauch:

        Hi,

        the resource needs to have rdf:type sp:Select (or sp:Ask
        etc). Could you
        send me the part of the (Turtle) source code that defines
        that resource,
        or (even better) print out the rdf:types of the resource in
        the Jena model?

        Thanks,
        Holger


        On 11/1/2013 13:38, [email protected] wrote:
        > Hi,
        >
        > I'm trying to convert a file of SPIN query in RDF to raw
        SPARQL query
        > with the API.
        > I used
        >

com.hp.hpl.jena.rdf.model.ModelFactory.createDefaultModel().read(InputStream,


        > String, String).createResource() to convert SPIN query to
        > com.hp.hpl.jena.rdf.model.Resource.
        > Converting to com.hp.hpl.jena.rdf.model.Resource might be
        successful
        >
        (com.hp.hpl.jena.rdf.model.Resource.getModel().write(Writer)
        runs well).
        > However,
        SPINFactory.asQuery(com.hp.hpl.jena.rdf.model.Resource)
        > returned null.
        > What is wrong?  The RDF file is right.
        > --
        > -- You received this message because you are subscribed to
        the Google
        > Group "TopBraid Suite Users", the topics of which include
        Enterprise
        > Vocabulary Network (EVN), TopBraid Composer, TopBraid Live,
        TopBraid
        > Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
        > To post to this group, send email to
        > [email protected]
        > To unsubscribe from this group, send email to
        > [email protected]
        > For more options, visit this group at
        > http://groups.google.com/group/topbraid-users?hl=en
        <http://groups.google.com/group/topbraid-users?hl=en>
        > ---
        > You received this message because you are subscribed to the
        Google
        > Groups "TopBraid Suite Users" group.
        > To unsubscribe from this group and stop receiving emails
        from it, send
        > an email to [email protected].
        > For more options, visit
        https://groups.google.com/groups/opt_out
        <https://groups.google.com/groups/opt_out>.

    --     -- You received this message because you are subscribed to
the Google
    Group "TopBraid Suite Users", the topics of which include
    Enterprise Vocabulary Network (EVN), TopBraid Composer, TopBraid
    Live, TopBraid Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
    To post to this group, send email to
    [email protected] <javascript:>
    To unsubscribe from this group, send email to
    [email protected] <javascript:>
    For more options, visit this group at
    http://groups.google.com/group/topbraid-users?hl=en
    <http://groups.google.com/group/topbraid-users?hl=en>
    ---
    You received this message because you are subscribed to the
    Google Groups "TopBraid Suite Users" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected] <javascript:>.
    For more options, visit https://groups.google.com/groups/opt_out
    <https://groups.google.com/groups/opt_out>.

--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise
Vocabulary Network (EVN), TopBraid Composer, TopBraid Live, TopBraid
Insight, SPARQLMotion, SPARQL Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
---
You received this message because you are subscribed to the Google
Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.



--
まつみや

--
-- You received this message because you are subscribed to the Google
Group "TopBraid Suite Users", the topics of which include Enterprise Vocabulary 
Network (EVN), TopBraid Composer, TopBraid Live, TopBraid Insight, SPARQLMotion, SPARQL 
Web Pages and SPIN.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/topbraid-users?hl=en
--- You received this message because you are subscribed to the Google Groups "TopBraid Suite Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to