On Tue, 2012-01-10 at 12:45 +0800, 锐光刘 wrote: > Dear DAVE, > I am sorry to reply you so late,since I have learn your tutorial and the > official manual about the blank node. I think I are already clear about it, > it indeed likes the anonymous inner class in JAVA.Thanks for your patient > explain.
No problem. > As you know, I want to store the data into database with > Hibernate. > But there is also problems as you told me, how to store the data into > database. My mind is that transform the data, such as statement, predicate > and RDFNode , into > binary and store them in database,while I have no idea how to transform > them ,is there some function in JENA to finish this work? If there is not, > how could I do this? If you want to store statements then you can either store then as a serialized string or have a table of separate subject, predicate, object serializations. Which of those you should do depends on why you are doing your own database (as you know, Jena already provides persistent storage of RDF with and without use of an underlying database). I can't help with that choice. Assuming it is statements you need to store, and you just want them as opaque blobs, then the easiest route is to use N-Triples serialization. The easiest way to that is to use model read/write into a string buffer. If that is not convenient or you are worried about overheads then there is low level support in ARQ for serializing/deserializing individual Triples (the structure underlying Statements) - see the class called SerializationFactory. > Well, if I can't transform them ,the final solution thought by myself is > that just store the URI and create resource when needed ,then transform the > new created resource > into statement, but it seems very inefficient. That's essentially what you are going to have to do, the N-Triples approach just gives you a particular serialization format which avoids you having to invent and implement your own. Don't forget there aren't just URIs, there's the blank nodes we have talked so much about and there are literals. Literals in turn have a lexical form, an optional language tag, and an optional datatype. So your serialization needs to copy with all those cases. Dave
