Je crée un graphique RDF à l'aide de l'instruction SPARQL CONSTRUCT. À la suite de ma requête:SPARQL CONCAT() et STR() avec CONSTRUCT
prefix map: <#>
prefix db: <>
prefix vocab: <vocab/>
prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#>
prefix xsd: <http://www.w3.org/2001/XMLSchema#>
prefix d2rq: <http://www.wiwiss.fu-berlin.de/suhl/bizer/D2RQ/0.1#>
prefix jdbc: <http://d2rq.org/terms/jdbc/>
prefix fn: <http://www.w3.org/2005/xpath-functions#>
CONSTRUCT {
map:database a fn:concat('d2rq:Database', ';').
map:database d2rq:jdbcDriver str(?o1).
map:database d2rq:jdbcDSN ?o2.
map:database d2rq:username ?o3.
map:database d2rq:password ?o4.
}
FROM <http://www.ndssl.vbi.vt.edu/epidl>
WHERE
{
<http://www.ndssl.vbi.vt.edu/epidl#NDSSLDB> <http://www.ndssl.vbi.vt.edu/epidl#driver> ?o1.
<http://www.ndssl.vbi.vt.edu/epidl#NDSSLDB> <http://www.ndssl.vbi.vt.edu/epidl#dsn> ?o2.
<http://www.ndssl.vbi.vt.edu/epidl#NDSSLDB> <http://www.ndssl.vbi.vt.edu/epidl#username> ?o3.
<http://www.ndssl.vbi.vt.edu/epidl#NDSSLDB> <http://www.ndssl.vbi.vt.edu/epidl#password> ?o4.
}
}
J'ai trouvé que fn: fonctions concat() et str() ne fonctionnent pas avec SPARQL Construct. La requête me donne une erreur. Cependant au-dessus des fonctions mentionnées fonctionne correctement avec les instructions select séparés comme suivants:
fn: concat()
prefix fn: <http://www.w3.org/2005/xpath-functions#>
select (fn:concat('d2rq:jdbcDriver', ';') AS ?p) where {?s ?p ?o} LIMIT 1
str()
select str(?o) from <http://www.ndssl.vbi.vt.edu/epidl>
where {<http://www.ndssl.vbi.vt.edu/epidl#NDSSLDB> <http://www.ndssl.vbi.vt.edu/epidl#dsn> ?o}
S'il vous plaît laissez-moi savoir comment puis-je utiliser fn: concat() et str() fonctionne avec SPARQL CONSTRUCT.
Pourquoi fais-tu fn: concat? Ça devrait juste être concaténé. Et la manière habituelle de le faire est une requête de construction avec une sous-requête select. Il y a d'autres questions qui ont des exemples utiles. –
E.g., voir http://stackoverflow.com/questions/33475950/use-aggregates-min-max-avg-in-construct-query –
Construire avec la sous-requête sélectionnée ne fonctionne pas pour moi. Pourriez-vous s'il vous plaît me donner un exemple? –