I would need more info to help. However here a starting point to help you. Let's take the vcard example given here: Representing vCard Objects in RDF
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix v: <http://www.w3.org/2006/vcard/ns#> .
<http://example.com/me/corky> a v:VCard ;
v:fn "Corky Crystal" ;
v:nickname "Corks" ;
v:tel
[ a v:Home, v:Voice ;
rdf:value "+61 7 5555 5555"
] ;
v:email <mailto:corky@example.com> ;
v:adr
[ a v:Home ;
v:country-name "Australia" ;
v:locality "WonderCity" ;
v:postal-code "5555" ;
v:street-address "111 Lake Drive"
] .
This record uses two bnode, one for v:tel and one for v:addr. If you simply want the phone and city of Corky you could use the following SPARQL
SELECT ?phone ?city
WHERE
{
_:s v:fn "Corky Crystal" ;
v:tel/rdf:value ?phone .
v:adr/v:locality ?city .
}
Notice I used property path for convenience, essentially this query is the same as the following
SELECT *
WHERE
{
_:s v:fn "Corky Crystal" ;
v:tel _:tel; #get the bnode for tel
v:adr _:adr; #get the bnode for adr
_:tel rdf:value ?phone .
_:adr v:locality ?city .
}
In other word, you simply need to traverse across the bnodes.
Now if for instance I add the following PropertyPathAxiom I mentioned in the previous response
ex:phone a owl:DataProperty ;
owl:propertyChainAxiom ( (v:tel rdf:value) .
ex:city a owl:DataProperty ;
owl:propertyChainAxiom ( (v:adr v:locality) .
When this is loaded it it will create several bnode, but in this case the bnode are an implementation detail and you do not need to worry about them in your query since the reasoner will handle everything for you under the cover. Therefore now if you want Corky phone number you simply need the following SPARQL query
SELECT *
WHERE {
_:s v:fn "Corky Crystal" ;
ex:phone ?phone ;
ex:city ?city .
}
In summary, if the blank node are part of your data structure, simply traverse as needed, if the blank node are part of your OWL definition, ignore them as your reasoner will handle everything for you.
This is one of the reason, I usually load the RDFS & OWL rules in a different namespace than my actual data.