I'm new to RDF & SPARQL and am trying to run a query where I'm
looking for <gics:35102020> as the object in the following quer -
however, it returns only one triple - whereas in my RDF/XML file gics:
35102020 is the object of 3 triples. I'm trying to link together
different industry classifcation schemes. It finds where I'm saying
that naics:621 sameAs gics:35102020, but it doesn't find the instances
of companies which are classified with an industry type of gics:
35102020. Below is my sample query:
PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#>
PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
PREFIX owl: <http://www.w3.org/2002/07/owl#>
PREFIX dcterms: <http://purl.org/dc/terms/>
PREFIX gics: <http://www.ewsolutions.com/#>
PREFIX naics: <http://www.ewsolutions.com/#>
PREFIX cmpy: <http://www.ewsolutions.com/#>
PREFIX vCard: <http://www.w3.org/2001/vcard-rdf/3.0#>
SELECT *
where { ?s ?p <gics:35102020> }
I get the following result:
s p
naics:621 http://www.w3.org/2002/07/owl#sameAs
Here's some background triples, from my RDF/XML file, parsed by the
W3C RDF validator.
gics:Sub-Industry http://www.w3.org/1999/02/22-rdf-syntax-ns#type
http://www.w3.org/2000/01/rdf-schema#Class
gics:35102020 http://www.w3.org/2000/01/rdf-schema#type gics:Sub-
Industry
gics:35102020 http://www.w3.org/2002/07/owl#sameAs naics:621
gics:35102020 http://www.ewsolutions.com/Sub-IndustryDescr "Owners and
operators of health care facilities, including hospitals, nursing
homes, rehabilitation centers and animal hospitals."
gics:35102020 http://www.ewsolutions.com/Sub-IndustryNumber "Health
Care Facilities"
naics:621 http://www.w3.org/2002/07/owl#sameAs gics:35102020
cmpy:Keystone http://www.ewsolutions.com/Sub-IndustryNumber
"rdf:resource="gics:35102020""
cmpy:Keystone http://www.ewsolutions.com/Sub-IndustryNumber "gics:
35102020"
The final two triples are where I'm trying to do basically the same
thing, but in different ways to get around the problem. I've tried
the following query, but no results returned:
SELECT *
where { ?s ?p gics:35102020 }
and also
SELECT *
where { ?s ?p "gics:35102020" }
In my sparql query, I'd like both the owl:sameAs triple, and the Sub-
IndustryNumber triple to be returned in the same query.
You're help will be greatly appreciated!!!
Below is the RDF/XML for the 3 triples.
Regards,
Pete
<rdf:Description
rdf:about="naics:621">
<rdfs:type rdf:resource="naics:SubSector"/>
<owl:sameAs rdf:resource="gics:35102020"/>
<naics:SubSectorName>Ambulatory Health Care Services</
naics:SubSectorName>
</rdf:Description>
# - Version 1 of assigning gics:35102020 to a hospital
<rdf:Description
rdf:about="cmpy:Keystone">
<rdfs:type rdf:resource="cmpy:Company"/>
<cmpy:CompanyName>Keystone Mercy</cmpy:CompanyName>
<cmpy:CusipNumber>009909999</cmpy:CusipNumber>
<gics:Sub-IndustryNumber>gics:35102020</gics:Sub-IndustryNumber>
</rdf:Description>
# - Version 2 of assigning gics:35102020 to a hospital (using
rdf:resource="gics:35102020"
<rdf:Description
rdf:about="cmpy:Keystone">
<rdfs:type rdf:resource="cmpy:Company"/>
<cmpy:CompanyName>Keystone Mercy</cmpy:CompanyName>
<cmpy:CusipNumber>009909999</cmpy:CusipNumber>
<gics:Sub-IndustryNumber>rdf:resource="gics:35102020"</gics:Sub-
IndustryNumber>
</rdf:Description>
It looks like the URI in your data is <gics:35102020> not
<http://www.ewsolutions.com/#35102020>. I'm writing <> around URIs to
show them as URIs, not prefixed names.
Using gics:35102020 (no <>) in your SPARQL query is a "prefixed name" -
take the prefix, add the local part to get
http://www.ewsolutions.com/#35102020
Output from the validator is N-triples which is a simple format with no
concept of prefixed names. When it says gics:35102020 it means a URI
with those characters, which is <gics:35102020> in SPARQL, not
gics:35102020 (no <>).
<owl:sameAs rdf:resource="gics:35102020"/>
RDF/XML does not expand the string value of rdf:resource - it is the URI
<gics:35102020>. You can use XML entities to help manage long strings.
rdf:resource="&gics;35102020" and define &gics; as
http://www.ewsolutions.com/#
"gics:35102020" is a string and is unrelated to <gics:35102020> or
gics:35102020
Andy
On 09/02/2010 11:49 PM, Pete Stiglich wrote:
> Hello,
>
> I'm new to RDF& SPARQL and am trying to run a query where I'm