Search By Name In Rdf/n3 File
I have to perform some filtering in a turtle/n3 file, returning another file of the same kind. The basic data element (location) i work on is this: :pt0001 vcard:category 'Pos
Solution 1:
If you want to get the triples for the subject which has that name exactly, you can do a simple describe:
describe ?s where { ?s vcard:fn "Ufficio Bologna 1". }
Otherwise, if you want to use a regex, you can modify the query slightly
describe ?s where { ?s vcard:fn ? name. filter (regex(?name, "regex goes here")). }
Though a word of caution, regex over large datasets can be expensive. Many systems offer extensions to SPARQL which will full-text index your literal values which you can then search over using a more normal search syntax.
Solution 2:
I solved like this:
CONSTRUCT {?s ?p ?o}
WHERE {
?s ?p ?o;
vcard:fn ?name.
FILTER regex (?name ,"^ufficio bologna 1$", "i")
}
Post a Comment for "Search By Name In Rdf/n3 File"