From: Saf H. <saf...@gm...> - 2005-09-15 09:08:15
|
Hi, New to RDF and PHP so this may be a simple syntax issue: Having consulted the tutorials and class details for statements, I'm still unclear as to how to set the label of a statement. I don't want to use the system-generated numbers e.g. by reifying a whole model - I just want to give my statements names of my choice. e.g. <a><b><c> reify as: 'Matilda' results in: <Matilda><type><statement> <Matilda><subj><a> <Matilda><pred><b> <Matilda><obj><c> I keep getting an error message regarding not being able to pass parameter 1 e.g. 'Matilda' whenever I use $statement_x->reify("Matilda"); Please could someone provide a worked example? I'm assuming 'Matilda' will be regarded as both a uri and url for this statement resource, like any other type of resource. Is this true? Thanks Saf |
From: Richard C. <ri...@cy...> - 2005-09-15 19:45:34
|
Hi Saf, On 15 Sep 2005, at 11:07, Saf Hulou wrote: > Hi, > > New to RDF and PHP Welcome! > so this may be a simple syntax issue: > > Having consulted the tutorials and class details for statements, I'm > still unclear as to how to set the label of a statement. I don't want > to use the system-generated numbers e.g. by reifying a whole model - I > just want to give my statements names of my choice. Okay. If you reify a statement, you say that a *resource* represents the statement. Let me repeat: A reified statement is not a "label" for a statement, it's a resource representing the statement. So it can be a URI or a blank node, but not a simple string. > e.g. > <a><b><c> reify as: 'Matilda' > results in: > <Matilda><type><statement> > <Matilda><subj><a> > <Matilda><pred><b> > <Matilda><obj><c> 'Matilda' is a string. A reified statement can be a URI or a blank node, but not a string. > I keep getting an error message regarding not being able to pass > parameter 1 e.g. 'Matilda' whenever I use > $statement_x->reify("Matilda"); You have to pass a model or a blank node. Passing a string doesn't work. > Please could someone provide a worked example? > > I'm assuming 'Matilda' will be regarded as both a uri and url for this > statement resource, like any other type of resource. Is this true? You really have to be more clear about the difference between URIs and simple strings. If you want to assign a simple string as a label to a reified statement, you can create an RDF graph like this: _:blank rdf:type rdf:Statement . _:blank rdf:subject :a . _:blank rdf:predicate :b . _:blank rdf:object :c . _:blank rdfs:label "Matilda" . (This is Turtle syntax) _:blank is the blank node representing the statement. All the other things with ":" in them are URIs (abbreviated as QNames). The rdfs:label triple assigns a label to the reified statement. That said, the reification support in RAP is clunky. Apparently there's no way to create a reified statement from a URI, you have to use a blank node. That's a limitation of RAP; RDF allows it. I probably caused more confusion than clarity with this response. Sorry about that! All the best, Richard > > Thanks > > Saf > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download > it for free - -and be entered to win a 42" plasma tv or your very own > Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > > |
From: Saf H. <saf...@gm...> - 2005-09-16 11:10:36
|
Hi Richard, Thank you for your reply. The last point - rap won't let me create a reified statement from a uri is precisely my problem. Sorry about the confusion with 'Matilda'. I used the string because I couldn't see the difference (as far as RDF is concerned) between 'Matilda' and ' http://www.my_statements.com/matilda'. It seems that I will have to create the blank node and create a label for the blank node, as you suggest. This is a bit wierd though. How do I pass a blank node id or a model to a reify function?=20 Isn't it a bit meaningless to create a blank node or model before I've reified the statement? Are they simply placeholders? I think I'm misunderstanding something here.... |
From: Richard C. <ri...@cy...> - 2005-09-20 18:22:30
|
Hi Saf, Sorry for the long delay. On 16 Sep 2005, at 13:10, Saf Hulou wrote: > The last point - rap won't let me create a reified statement from a > uri is precisely my problem. Ah, I see. It's a RAP limitation. > It seems that I will have to create the blank node and create a label > for the blank node, as you suggest. This is a bit wierd though. > How do I pass a blank node id or a model to a reify function? When you pass a blank node, then that blank node will simply be used as the subject of the four reification statements. To create a blank node, do "$blank = new BlankNode($model)". What happens when you pass a model is this: RAP creates a new blank node, which becomes the representation of the reified statement. The model is needed only because of the way RAP creates blank nodes. RAP uses the model to make sure that the blank node is unique (within that model). Don't you have a model anyway where your statements are stored? You just can use that model as the argument to $statement->reify. You don't have to create a new model. > Isn't it a bit meaningless to create a blank node or model before I've > reified the statement? Are they simply placeholders? As I said, you don't have to create the blank node yourself. The reify method can create it for you. However, you have to pass in some model because RAP needs one to create unique blank nodes. Don't pass a new model every time, but re-use the model you're working with anyway. > I think I'm misunderstanding something here.... Sorry about that. RAP's reification support is a bit strange and doesn't seem to be used very much. I think what you probably want to do is this: $new_blank_node = $model->reify_statement($statement) This would create a new blank node and it would add the four reification statements to $model. In RAP you have to do this to get the same effect: $new_blank_node = new BlankNode($model) $reification_quad = $statement->reify($new_blank_node) $model->addModel($reification_quad) (But this doesn't work currently because of a bug, I'll send a separate mail about that.) Hope that helps. Richard > > > ------------------------------------------------------- > SF.Net email is sponsored by: > Tame your development challenges with Apache's Geronimo App Server. > Download > it for free - -and be entered to win a 42" plasma tv or your very own > Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php > _______________________________________________ > Rdfapi-php-interest mailing list > Rdf...@li... > https://lists.sourceforge.net/lists/listinfo/rdfapi-php-interest > > |