I want to write some reusable SPARQL queries to do things like take an IRI, get the name part (typically after the # sign), modify it (e.g., replace underscores with blank spaces) and put it in the rdfs:label property. This would be useful for Protege which doesn't fill in the rdfs:label if you use user defined IRIs. Or take an IRI with a user defined name, do the same and then replace the user defined IRI with a UUID. I looked in the SPARQL spec for functions to manipulate IRIs and either they don't exist or I'm missing something obvious. I'm posting this to make sure it isn't the latter. I know it is easy to do the equivalent with things like SUBSTR but I'm surprised that there aren't predefined operators to do things like getting the name part of an IRI and getting the base and want to double check before I roll my own.
Functions in SPARQL to Manipulate IRIs?
483 Views Asked by Michael DeBellis At
1
There are 1 best solutions below
Related Questions in SPARQL
- How to combine ontotext GraphDB autocomplete and SPARQL to refine searching?
- How to only pass specific solution bindings from the default graph to the VALUES clause of the federated query?
- Expansive path expressions in quoted triples?
- Fuzzy String Match in SPARQL
- Blazegraph: How to LOAD gzip files?
- SPARQL query response to objects
- SPARQL Query - WHERE ignoing clause? (dbpedia)
- How to find all titles including a certain word in SPARQL
- How apply an order to CONSTRUCT in SPARQL
- Get Wikipedia page ID from WikiData ID
- how to query local fuseki server using python
- How to extract the language tags from Turtle RDF data?
- ontology versioning: Link both versionIRI#MyClassIRI and ontologyIRI#MyClass123 to same resource in rdf / owl
- Is it possible to directly run SPARQL query against webpages with JSON-LD data?
- Weird behavior on LIMIT and OFFSET when querying DBPedia
Related Questions in IRI
- Using prefixes in Cellfie
- Escaping quotes in SPARQL
- Getting Labels in SPARQL Aggregate
- How to encode IRI (Internationalized Resource Identifier) to actual text in NextJS?
- Bad character in IRI in Jena when reading OWL/RDF model
- How to get RDF data returned by remote HTTP IRI through linux curl (e.g. DBpedia, GENEPIO ...)?
- How to parse arbitrary RDF IRI through javascript?
- RDF vocabulary to specify a RDF resource IRI's structure
- Java doesn't support IRI?
- How to add an Ontology IRI with the Python rdflib library?
- IRIs: Shall http or https be used?
- Functions in SPARQL to Manipulate IRIs?
- Disable IRI api-platform
- API Platform custom IRI with value objects
- Use of IRI in RDF N-Triples
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
In case anyone else wants to do this, I figured it out. There are some answers on this site but they are all for SQL or other languages than SPARQL. The following is for classes and it should be obvious how to adapt it for other entities. Note: this works in the Snap SPARQL Plugin for Protege (that's why I use CONSTRUCT rather than INSERT), however, there is a bug in their implementation of SUBSTR so that it uses 0 based indexing rather than 1 based as the spec says. So if you use this in Snap SPARQL change the 1 to a 2.