Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Handling a URI as a request parameter in Semantic Web applications

Over the last few years, on a number of applications, I've used RDF as a data model and used Jena to manage and query the data. For new applications I try to design applications to be RESTful and URLs in the application usually have some representation in the RDF. For example:

http://example.com/foo/bar/1/

However, occasionally you need to drill down or call a URI from a servlet in a request parameter:

http://example.com/foo/bar/1/?id=http://example.com/foo/bar/xyz/

The URLs get pretty ugly and unfriendly, especially when encoded:

http://example.com/foo/bar/1/?id=http%3A%2F%2Fexample.com%2Ffoo%2Fbar%2Fxyz%2F

Is there a best practice in design? Should I be creating a separate shorter value than a URI in the RDF that I can query on?

like image 353
MikeJ Avatar asked Oct 29 '25 13:10

MikeJ


1 Answers

If you have a known, or knowable, set of prefixes then abbreviating URI's to q-names is a pattern I've used in the past:

http://example.com/foo/bar/1/?id=example:xyz

In the linked data API, short-names for entities can be declared in the configuration, typically by stating which property of a resource is used to denote its short name (e.g: rdfs:label or skos:notation). So the pattern there is to use a small amount of configuration information to provide name abbreviations via the RDF model itself.

like image 103
Ian Dickinson Avatar answered Oct 31 '25 10:10

Ian Dickinson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!