Question on usage of Prefix

Hi
I am new to stardog. Can i use any random string as Prefix? what is the downside? For example, can i use my name

PREFIX kv: <krishna.vemulapalli#>

what is the downside of such usage?

is PREFIX a way to use ontologies defined by other users? What if my application has no need to reference ontology defined by other users and i need to define my own ontology.

thank you

You can’t use any random string. I’d have to look up the exact restrictions but as long as you keep it to something reasonable you should be able to name it whatever you want.

I can’t really think of a downside. They’re really just syntactic sugar that helps you avoid a lot of typing. The example you gave is a perfectly fine prefix name but the namespace isn’t. It needs to be a valid IRI and <krishna.vemulapalli#> isn’t. You could change it to urn:krishna.vemulapalli# or http://krishna.vemulapalli# The IRI doesn’t have to resolve and the domain name isn’t required to be registered to use it although it’s bad practice to use someone else’s domain.

You should be able to use someone else’s ontology or your own or both.

I agree with Zachary that there is no downside to using prefixed URIs. Just remember to include the Prefix line if you ever share the query with someone! Here's a quick example of "syntactic sugar" using one of our application's ontologies.

with prefixes
PREFIX vuln: <tag:darklight:vulnerabilitymanagement#>

SELECT DISTINCT ?problem ?details
WHERE {
    GRAPH ?g {
        ?vs a vuln:VulnerabilityScan ;
            vuln:hasScanAnalysis ?sa .
        ?sa vuln:hasScanAnalysisID ?AnalysisID ;
            vuln:hasCWSSTable ?table .
        ?table vuln:hasCWSSRow ?row .
        ?row vuln:hasRecordSource ?vr .
        ?vr a vuln:VulnerabilityRecord .
        ?vr vuln:hasPluginName ?problem .
        ?vr vuln:hasDescription ?details .
    }
}
without prefixes

SELECT DISTINCT ?problem ?details
WHERE {
    GRAPH ?g {
        ?vs a <tag:darklight:vulnerabilitymanagement#VulnerabilityScan> ;
            <tag:darklight:vulnerabilitymanagement#hasScanAnalysis> ?sa .
        ?sa <tag:darklight:vulnerabilitymanagement#hasScanAnalysisID> ?AnalysisID ;
            <tag:darklight:vulnerabilitymanagement#hasCWSSTable> ?table .
        ?table <tag:darklight:vulnerabilitymanagement#hasCWSSRow> ?row .
        ?row <tag:darklight:vulnerabilitymanagement#hasRecordSource> ?vr .
        ?vr a <tag:darklight:vulnerabilitymanagement#VulnerabilityRecord> .
        ?vr <tag:darklight:vulnerabilitymanagement#hasPluginName> ?problem .
        ?vr <tag:darklight:vulnerabilitymanagement#hasDescription> ?details .
    }
}

Thank you Ian and zachary.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.