How to change default instance URI behavior?

4 views
Skip to first unread message

Brandon

unread,
Mar 29, 2010, 8:32:53 PM3/29/10
to jenabean-dev
From the example on the home page below, I would like the URI for the
instance of the class "http://test.bean/KeepItSimple/kisv1.1" not to
include the class itself as only "http://test.bean/kisv1.1". How can I
achieve this using configuration, existing classes, or modifying which
source class?

package test;
import thewebsemantic.Id;

public class KeepItSimple {
@Id
private String id;
private int value;
public int getValue() {return value;}
public void setValue(int i) {value = i;}
public String getId() {return id;}
public void setId(String id) {this.id = id;}
}

@prefix : <http://test.bean/> .

<http://thewebsemantic.com/javaclass>
a owl:AnnotationProperty .

<http://test.bean/KeepItSimple/kisv1.1>
a :KeepItSimple ;
:id "kisv1.1"^^xsd:string ;
:value "444"^^xsd:int .

:KeepItSimple
a rdfs:Class ;
<http://thewebsemantic.com/javaclass>
"test.bean.KeepItSimple" .

:id a rdf:Property .

:value
a rdf:Property .

Taylor Cowan

unread,
Mar 31, 2010, 10:51:14 PM3/31/10
to jenabe...@googlegroups.com
Hi Brandon,

You cannot remove the class position entirely at the moment. That
would cause the id to loose it's context and open the possibility of
having two things with the same URI. There is a way to override the
default of using the class name.

@RdfType overrides the default behavior

@RdfType("different")
public class Foo...

Would then be:
http://.../different/id

Can you suggest some ways of specifying that the URI not include the
class part...maybe

RdfType(blank=true) or something like that? If we can arrive at good
semantics for indicating that situation it shouldn't be too hard to
code that.

Taylor

> --
> You received this message because you are subscribed to the Google Groups "jenabean-dev" group.
> To post to this group, send email to jenabe...@googlegroups.com.
> To unsubscribe from this group, send email to jenabean-dev...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/jenabean-dev?hl=en.
>
>

Brandon

unread,
Apr 1, 2010, 11:26:55 AM4/1/10
to jenabean-dev
Right now I am using the @thewebsemantic.Uri tag to override the
Instance Id's. Is this okay or is this deprecated (http://
groups.google.com/group/jenabean-dev/browse_thread/thread/
34aa18f8d4221599)? Is a public constructor taking the Namespace and Id
necessary (I was reading an old post) ? It appears to be working
although I am debugging a possible issue right now with cause unknown.

I think something like this might work:
@RdfType("TypeName",includeInInstance=false)

Another Idea would be to provide templating for instances, for
example:
${namspace}${RdfType}/${id}

Thanks for your help,
Brandon

Reply all
Reply to author
Forward
0 new messages