는 RDF에는 앞에 둔 URI를이 없습니다 :-)
사전에 의해 감사, 이것은 단지 프리젠 테이션의 개념하지만 데이터의 일부입니다. 간단한 SPARQL 쿼리로 얻을 수있는 것은 완전한 URI를 가진 리소스, 예를 들어
http://xmlns.com/foaf/0.1/Person
입니다. 문자열 함수로 할 수있는 일은 이미 알았 듯이 네임 스페이스와 로컬 이름으로 분리하는 것입니다.
접두어가 붙은 URI를 정말로 갖고 싶다면 먼저 접두사 매핑이 필요합니다. foaf -> http://xmlns.com/foaf/0.1/
.
PREFIX foaf: <http://xmlns.com/foaf/0.1/>
SELECT ?prefixedName
(strbefore(?prefixedName,":") as ?prefix)
(strafter(?prefixedName,":") as ?name) {
# dummy value
VALUES ?uri {<http://xmlns.com/foaf/0.1/Person> }
# get a prefixed name of the URI as string literal
BIND(replace(str(?uri), str(foaf:), "foaf:") as ?prefixedName)
}
출력 :
+--------------+--------+--------+
| prefixedName | prefix | name |
+--------------+--------+--------+
| foaf:Person | foaf | Person |
+--------------+--------+--------+
그런 다음 작업을 수행 할 수