Date: 2010-08-02 16:31:52
From: kyh.dev-at-gmail.com
Hi, all:
I create a context like follow?
String location = "http://example.org/example/example.rdf";
URI context = f.createURI(location);
con.add(sub, predicate, obj, context);
i want to query  in the ?context? use sparql,  how should i do ?
Thanks!

asked 03 Apr '13, 04:29

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

edited 18 Apr '13, 05:57

nkrustev's gravatar image

nkrustev ♦♦
66117


Date: 2010-08-11 21:12:53
From: barry.bishop-at-ontotext.com
Hi Yonghong,
A named graph is just that, a graph with a name. Sesame calls this name
a 'context'.
The way named graphs behave is to extend the triple data model to a
quad, i.e. each statement is subject-predicate-object-context, where
'context' can be null.
To add a statement with a context, here is an example:
Repository repository = ....;
RepositoryConnection conn = repository.getConnection();
ValueFactory vf = repository.getValueFactory();
URI subj = vf.createURI("http://example.org/owlim#Pilot");
URI obj = vf.createURI("http://example.org/owlim#Human");
URI context = vf.createURI("http://example.org/owlim#People");
repositoryConnection.add(subj, RDF.TYPE, obj, context);
repositoryConnection.commit();
repositoryConnection.close();
I hope this helps,
barry
link

answered 03 Apr '13, 04:30

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

edited 18 Apr '13, 05:57

nkrustev's gravatar image

nkrustev ♦♦
66117

Date: 2010-08-02 10:46:07
From: barry.bishop-at-ontotext.com
Hi Yonghong,
If you have not done this before, probably the best place to start is to
read here:
http://www.w3.org/TR/rdf-sparql-query/#namedGraphs
You will need to use FROM or FROM NAMED or a combination of the two. I
won't explain further, as the above URL explains it better than I could.
Best of luck,
barry
--
Barry Bishop
OWLIM Product Manager
Ontotext AD
Tel: +43 650 2000 237
email: barry.bishop at ontotext.com
www.ontotext.com
link

answered 03 Apr '13, 04:29

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

edited 18 Apr '13, 05:57

nkrustev's gravatar image

nkrustev ♦♦
66117

Date: 2010-08-02 10:02:14
From: j.kopecky-at-open.ac.uk
Hi Yonghong, 
a quick example adapted from the link sent by Barry:
SELECT * 
FROM NAMED <http://example.org/example/example.rdf>
WHERE { your graph pattern }
This should just use the triples in that particular context.
Hope it helps,
Jacek
link

answered 03 Apr '13, 04:29

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

edited 18 Apr '13, 05:57

nkrustev's gravatar image

nkrustev ♦♦
66117

Date: 2010-08-04 16:17:20
From: kyh.dev-at-gmail.com
Thank you very much,i'ill try what you said.
link

answered 03 Apr '13, 04:30

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

edited 18 Apr '13, 05:57

nkrustev's gravatar image

nkrustev ♦♦
66117

Date: 2010-08-11 23:09:33
From: kyh.dev-at-gmail.com
*It seems* that a sesame context is different from a named graph, isn't it?
If i want to add a statement to a named graph,So how should do?
link

answered 03 Apr '13, 04:30

Discussion-Board-Archive's gravatar image

Discussion-B...
6.1k133156205
accept rate: 30%

edited 18 Apr '13, 05:57

nkrustev's gravatar image

nkrustev ♦♦
66117

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×261
×242
×37

Asked: 03 Apr '13, 04:29

Seen: 5,522 times

Last updated: 28 May, 05:24

powered by BitNami OSQA