tags:

views:

36

answers:

2

i need to get the property value of the rdfs file which was belongs to my ontology..it has kilometer property and the value of it is 12500.00.. i need to get this value.... in my rdfs file there is no URI....

CAN ANY ONE SHOW ME THE WAY FOR DO THIS::::

+1  A: 
SELECT ?value WHERE {
    ?thing <http://whatever/myvocabulary.rdfs#kilometer&gt; ?value .
}

Replace the URI inside <...> with the actual URI of the kilometer property in your vocabulary.

Oh and did you try reading a SPARQL tutorial?

cygri
i read it in to some extent.. but i didn't have actual URL in my rdf file...that's why i faced this problem... i wrote some articals related to RDF also..how can i get the URI of my RDF file ? ...and it's on my local machine...thanks for your reply...
A: 

It would be a lot easier to answer your question if you could show a sample of the data that you're trying to query. I can hypothesise two reasons why you say "in my RDFS file there is no URI":

  • the URI's in your document are abbreviated so do not look like traditional http://... URI's, for example they may be in the form somePrefix:some-name
  • the value you are trying to query is attached to a so-called blank node, or a resource with no URI.

In the first case, it's simply a case of expanding the prefix. In the second case, you have to construct a path to query from a node you can identify (either by name, or by its properties) to the node you are trying to query. Easy to do in either case, but harder to explain in abstract - it will be much easier if you show your actual data.

In the comments you asked: "how can I get the URI of my RDF file?". Again I'm going to have to guess, but I presume that you are trying to reference your ontology file by URI in your program (e.g. to load it into a Jena model). There are three possibilities I can think of:

  • you want to reference a file: URI; for example the ontology at c:\User\fred\vocabs\foo.ttl would be file:///c:/User/fred/vocabs/foo.ttl, whereas /home/fred/vocabs/foo.txt would be file:///home/fred/vocabs/foo.txt. Note that there are three forward-slash characters after the file: prefix.

  • you want to reference the file via a local Apache server or similar; if your ontology is in /home/fred/public_html/vocabs/foo.ttl then the URI would be something like http://localhost:8080/~fred/vocabs/foo.ttl (details may vary depending on how you set up your server)

  • you host the file in a Joseki instance or similar, in which case the URI will be determined by your Joseki configuration, see the Joseki documentation for details.

Ian Dickinson