|
From: Tomasz P. <tom...@gm...> - 2014-07-03 18:58:37
|
First, your example is not a valid RDF/XML. AFAIK text nodes are valid, when they are a value of a literal property. Such as Bob is 20 years old. In NTriples: <Bob> <age> 20 . could be written as <rdf:Description rdf:about="Bob> <age>20</age> </rdf:Description> or it could use XML attribute <rdf:Description rdf:about="Bob age="20" /> Your example is missing one part of the triple. Either predicate or object. The subject is MyClass01ID but what is xxx? A full statement about MyClass01ID requires that there is a verb (predicate/property) and the value (object). I must stress again, that a RDF-aware system cannot require any specific formatting of a RDF/XML document. I understand that maybe other RDF formats aren't supported but in the end it is the data that s important and it can be written in various ways without chaging the meaning. I could also suggest that you read some introductory documents about RDF like [1] and maybe RDF/XML documentation [2], since you are working with that format. Though by using dotNetRDF or any other library you shouldn't be at all concerned with it. It is the graph that matters and you should never really have to manipulate raw RDF/XML document save maybe for debugging. Tom [1] http://www.w3.org/TR/rdf11-primer/ [2] http://www.w3.org/TR/rdf-syntax-grammar/ On Thu, Jul 3, 2014 at 5:39 PM, son...@gm... <son...@gm...> wrote: > Thank you for the help > > but I am sorry that I still not very clear how to do > the target system requires this format: > > ------------------------------------ > <MyClass01 rdf:about="MyClass01ID"> > xxx > </MyClass01> > ------------------------------------ > How can i create this (not rdf:Description xxx)? > > Best Wishes > > ________________________________ > son...@gm... > > From: Tomasz Pluskiewicz > Date: 2014-07-03 15:21 > To: dotNetRDF Developer Discussion and Feature Request > Subject: Re: [dotNetRDF-Develop] Writing <rdf:about> as RDF/XML format > In RDF this is a relation like any other. You state exactly what you > described, that a resource is of a given type. And you declare that > statement with a triple like any other fact about your resources. > > You use the predicate rdf:type [1]. There is a handy class called > VDS.RDF.Parsing.RdfSpecsHelper, which contains the correct Uri of the > rdf namespace. > > On Thu, Jul 3, 2014 at 4:03 PM, son...@gm... > <son...@gm...> wrote: >> Thank you so much Tom! >> >> there only just one question left: >> Since the target system need to know the class type, i.e., >> ==> MyClass01Id is a MyClass01 >> How can I express this in dotnetrdf? >> >> >> ________________________________ >> son...@gm... >> >> From: Tomasz Pluskiewicz >> Date: 2014-07-01 21:53 >> To: dotNetRDF Developer Discussion and Feature Request >> Subject: Re: [dotNetRDF-Develop] Writing <rdf:about> as RDF/XML format >> On Tue, Jul 1, 2014 at 12:23 PM, son...@gm... >> <son...@gm...> wrote: >>> Thank you Tom! >>> >>> You are right, basically what I am trying to do is converting following >>> class: >>> ------------------------------------- >>> class MyClass01 { >>> public string Property01 {get; set;} >>> public MyClass02 myClass02 {get; set;} >>> } >>> //the instance of class has its own unique id >>> >> >> I strongly suggest that you think in terms of triples or graphs and >> not their serializaitions. So given an instance of MyClass01 you could >> have the following data >> >> <MyClass01Id> <hasProperty01> "the value of this property". >> <MyClass01Id> <hasMyClass02> <MyClass02Id> . >> >> This is all you need. These two triples would be stored the way you >> used in the earlier email (remember to use proper URIs). I know >> nothing about MyClass02 at this point, just the hypothetical id. It >> would add further similar triples >> >> Notice how this notation (NTriples/Turtle) removes any unnecessary >> syntactic clutter and leaves only the subjects, predicates and >> objects. >> >>> >>> ------------------------------------- >>> to this kind of text >>> ------------------------------------- >>> <rdf:RDF xmlns:rdf=http://www.w3.org/1999/02/22-rdf-syntax-ns# >>> xmlns:KB="http://protege.stanford.edu/kb#"> >>> <KB:MyClass01 rdf:about="that unique id"> >>> <hasProperty01 >the value of this property</hasProperty01> >>> <MyClass02 rdf:about="the unique id"> >>> //MyClass02's content >>> </MyClass02> >>> </KB:EndToEndBlueprintRoot> >>> </rdf:RDF> >>> ------------------------------------- >>> >> >> You must keep in mind that with RDF/XML there are multiple ways to >> write the same document. It means that the structure can change, while >> the actual data doesn't. >> >>> >>> Also I have to use this kind of format because it is the input of another >>> system I have to use... >>> >> >> In memory you keep the data (triples) and dotNetRDF helps you save it >> in one of the RDF formats. If the other system requires that you use >> RDF/XML, that's fine but you could save it as Turtle or Notation3. >> >>> >>> Thank you again! >>> >>> ________________________________ >>> son...@gm... >>> >>> From: Tomasz Pluskiewicz >>> Date: 2014-07-01 10:13 >>> To: dotNetRDF Developer Discussion and Feature Request >>> Subject: Re: [dotNetRDF-Develop] Writing <rdf:about> as RDF/XML format >>> On Tue, Jul 1, 2014 at 7:44 AM, son...@gm... >>> <son...@gm...> wrote: >>>> Hi, all >>>> >>>> I am trying to write a RDF/XML like follows: >>>> ------------------------------------------------------- >>>> <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >>>> xmlns:KB="http://protege.stanford.edu/kb#"> >>>> <KB:EndToEndBlueprintRoot >>>> rdf:about="http://protege.stanford.edu/kb#DemoRootImagineID001"> >>>> xxxxx >>>> </KB:EndToEndBlueprintRoot> >>>> </rdf:RDF> >>>> ------------------------------------------------------- >>>> >>> >>> First of all this document is not a valid RDF/XML. >>> >>>> Here is my code >>>> ------------------------------------------------------- >>>> INode s = g.CreateUriNode("kb:"+"EndToEndBlueprintRoot"); >>>> INode p = g.CreateUriNode("rdf:about"); >>>> INode o = g.CreateUriNode("kb:"+"DemoRootImagineID001"); >>>> >>>> g.Assert(new Triple(s,p,o)); >>>> >>>> RdfXmlWriter rxw = new RdfXmlWriter(); >>>> string res = VDS.RDF.Writing.StringWriter.Write(g, rxw); >>>> ------------------------------------------------------- >>>> >>> >>> Secondly, the rdf:about is just a RDF/XML syntax feature and not a >>> predicate. It denotes that part of an RDF/XML document is grouped with >>> a common subject. Please read [1]. >>> >>> You should think in terms of triples, which define a relation >>> (predicate) between two objects (subjects and objects). That is much >>> like in natural language. >>> >>>> >>>> But only got this >>>> ------------------------------------------------------- >>>> <rdf:RDF xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#" >>>> xmlns:xsd="http://www.w3.org/2001/XMLSchema#" >>>> xmlns="http://example.org/" >>>> xmlns:a="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >>>> xmlns:kb="http://protege.stanford.edu/kb#" >>>> xmlns:ns0="http://www.w3.org/1999/02/22-rdf-syntax-ns#" >>>> xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"> >>>> <rdf:Description rdf:about="&kb;EndToEndBlueprintRoot"> >>>> xxx >>>> <ns3:about xmlns:ns3="http://protege.stanford.edu/system#" >>>> rdf:resource="&kb;DemoRootImagineID001" /> >>>> </rdf:Description> >>>> </rdf:RDF> >>>> ------------------------------------------------------- >>>> >>>> Is my usage correct? or how can I output the format that I want? >>>> What is the appropriate writing of "rdf:about"? >>>> >>> >>> You probably mean kb:DemoRootImagineID001 as you subject, that is the >>> thing you want to describe in your document. Is that right? >>> >>> Please describe what kind of data you want your document to contain. >>> >>>> >>>> Any suggestion will be appreciated! >>>> >>>> ________________________________ >>>> son...@gm... >>>> >>> >>> Regards, >>> Tom >>> >>> [1] >>> >>> >>> http://stackoverflow.com/questions/7118326/differences-between-rdfresource-rdfabout-and-rdfid >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Open source business process management suite built on Java and Eclipse >>> Turn processes into business applications with Bonita BPM Community >>> Edition >>> Quickly connect people, data, and systems into organized workflows >>> Winner of BOSSIE, CODIE, OW2 and Gartner awards >>> http://p.sf.net/sfu/Bonitasoft >>> _______________________________________________ >>> dotNetRDF-develop mailing list >>> dot...@li... >>> https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> Open source business process management suite built on Java and Eclipse >>> Turn processes into business applications with Bonita BPM Community >>> Edition >>> Quickly connect people, data, and systems into organized workflows >>> Winner of BOSSIE, CODIE, OW2 and Gartner awards >>> http://p.sf.net/sfu/Bonitasoft >>> _______________________________________________ >>> dotNetRDF-develop mailing list >>> dot...@li... >>> https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop >>> >> >> >> ------------------------------------------------------------------------------ >> Open source business process management suite built on Java and Eclipse >> Turn processes into business applications with Bonita BPM Community >> Edition >> Quickly connect people, data, and systems into organized workflows >> Winner of BOSSIE, CODIE, OW2 and Gartner awards >> http://p.sf.net/sfu/Bonitasoft >> _______________________________________________ >> dotNetRDF-develop mailing list >> dot...@li... >> https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop >> >> >> ------------------------------------------------------------------------------ >> Open source business process management suite built on Java and Eclipse >> Turn processes into business applications with Bonita BPM Community >> Edition >> Quickly connect people, data, and systems into organized workflows >> Winner of BOSSIE, CODIE, OW2 and Gartner awards >> http://p.sf.net/sfu/Bonitasoft >> _______________________________________________ >> dotNetRDF-develop mailing list >> dot...@li... >> https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop >> > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > http://p.sf.net/sfu/Bonitasoft > _______________________________________________ > dotNetRDF-develop mailing list > dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop > > ------------------------------------------------------------------------------ > Open source business process management suite built on Java and Eclipse > Turn processes into business applications with Bonita BPM Community Edition > Quickly connect people, data, and systems into organized workflows > Winner of BOSSIE, CODIE, OW2 and Gartner awards > http://p.sf.net/sfu/Bonitasoft > _______________________________________________ > dotNetRDF-develop mailing list > dot...@li... > https://lists.sourceforge.net/lists/listinfo/dotnetrdf-develop > |