Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

f:string-last-index-of fails on relative uri with slash #14

Open
VladimirAlexiev opened this issue May 23, 2018 · 0 comments
Open

f:string-last-index-of fails on relative uri with slash #14

VladimirAlexiev opened this issue May 23, 2018 · 0 comments

Comments

@VladimirAlexiev
Copy link

Input:

@base                      <http://data.businessgraph.io/>.
<status/> a skos:ConceptScheme, owl:NamedIndividual;

Note the ConceptScheme URL ends in /: I think this is a legit and often used convention for concept schemes (so one could define a prefix for it eg status:, and use it in Concept qnames, eg status:active).

Causes this error:

Type error at char 146 in xsl:variable/@select on line 1799 column 236 of extraction.xsl:
  XPTY0004: An empty sequence is not allowed as the third argument of substring()
  at xsl:apply-templates (extraction.xsl#1116)
     processing /assertions/assertion[1]/@rdf:resource
  at xsl:call-template name="get.individual.assertions" (extraction.xsl#1015)
  at xsl:call-template name="get.individual.description" (extraction.xsl#454)
  at xsl:apply-templates (extraction.xsl#1605)
     processing /rdf:RDF/owl:NamedIndividual[3]
  at xsl:call-template name="get.namedindividuals" (extraction.xsl#182)
  at xsl:call-template name="structure" (extraction.xsl#193)
  at xsl:apply-templates (extraction.xsl#105)
     processing /rdf:RDF/owl:Ontology[1]
  in built-in template rule
An empty sequence is not allowed as the third argument of substring()

The reported line is last below:

    <xsl:function name="f:getPrefixFromIRI" as="xs:string?">
        <xsl:param name="iri" as="xs:string" />
        
        <xsl:if test="not(starts-with($iri,'_:'))">
            <xsl:variable name="iriNew" select="if (contains($iri,'#') or contains($iri,'/')) then $iri else concat(base-uri($root), $iri)" as="xs:string" />
            
            <xsl:variable name="ns" select="if (contains($iriNew,'#')) then substring($iriNew,1,f:string-first-index-of($iriNew,'#')) else substring($iriNew,1,f:string-last-index-of(replace($iriNew,'://','---'),'/'))" as="xs:string" />

Maybe iriNew is to blame? It assumes that an iri with #/ is absolute. My turtle example uses a relative IRI with / but when I examine the corresponding rdf, I don't see any relative IRIs...

My XSL debugging skills are non-existent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant