Defining uniqueness: Tracker SPARQL Library Reference Manual

## Defining uniqueness

It is desirable for certain properties to keep their values unique across all resources, this can be expressed by defining the properties as being a nrl:InverseFunctionalProperty.

    ex:geneticInformation a rdf:Property, nrl:InverseFunctionalProperty;
                          rdfs:domain ex:Eukaryote;
                          rdfs:range xsd:string;

With that in place, no two resources can have the same value on the property.

    # First insertion, this will succeed
    INSERT DATA { <drosophila> a ex:Eukariote;
                               ex:geneticInformation "AGCT" }

    # This will fail
    INSERT DATA { <melanogaster> a ex:Eukariote;
                                 ex:geneticInformation "AGCT" }