简体   繁体   中英

How to query an RDF individual for its data properties?

I have an ontology where arc_cfp is an individual of class Arc . I would like to know how could I get all the data properties of the individual, given that I have the individual's URI?

Basically, I am doing this:

SELECT ?idRef ?name ?src ?dst ?perf
WHERE 
{
    ?x rdf:type http://www.semanticweb.org/ontologies/2012/1/graph.owl#arc_cfp .
    ?x graph:idRef_arc ?idRef .
    ?x graph:name_arc ?name .
    ?x graph:hasSource ?src .
    ?x graph:hasDestination ?dst .
    ?x graph:hasPerformatif ?perf .
}

I am pretty sure, using rdf:type is the problem. But, I have no idea what I need to use.

Thanks.

~Codera

Assuming you want a purely exploratory query of the form "give me all the triples about a subject" it should look the following:

SELECT *
WHERE
{
  <http://example.org/SomeThing> ?p ?o
} 

This will give you all predicate object pairs associated with the constant URI you pass in. If you are interesting in incoming as well as outgoing properties you could do the following instead:

SELECT *
WHERE
{
  { <http://example.org/SomeThing> ?p ?o }
  UNION
  { ?s ?p <http://example.org/SomeThing> }
} 

You can also use a DESCRIBE query to grab all the RDF data about a Resource.

PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
DESCRIBE ?x
WHERE
{
    ?x rdf:type http://www.semanticweb.org/ontologies/2012/1/graph.owl#arc_cfp .
}

PS Don't forget to put prefixes in your queries.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM