Reputation: 79
Could someone explain why Protégé (5.2) is adding a prefix to some classes and to some not? View is set to short IRI name.
I see foaf:Agent
, dcterm:Agent
or geo:SpatialThing
. But no bio:Event
, only Event
!
Here is the ontology:
@prefix : <http://www.semanticweb.org/anato/ontologies/2017/7/untitled-ontology-210#> .
@prefix bio: <http://purl.org/vocab/bio/0.1/> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix xml: <http://www.w3.org/XML/1998/namespace> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
<http://www.semanticweb.org/anato/ontologies/2017/7/untitled-ontology-210> a owl:Ontology ;
owl:imports <http://purl.org/vocab/bio/0.1/> , <http://www.w3.org/2006/time#2016> , <http://xmlns.com/foaf/0.1/> .
#
#
# #################################################################
# #
# # Classes
# #
# #################################################################
#
#
# http://xmlns.com/foaf/0.1/Person
foaf:Person a owl:Class .
#
# Generated by the OWL API (version 4.2.6.20160910-2108) https://github.com/owlcs/owlapi
Upvotes: 1
Views: 2148
Reputation: 11479
If you want to see prefixes, select View > Render by prefixed name.
Perhaps you should input these prefixes on Active Ontology > Ontology prefixes first.
The question should be: why prefixes are shown even when View > Render by entity IRI short name is selected.
It looks strange, but according to the source code, Protégé really should display some prefixes even in the short name rendering mode:
public String render(IRI iri) {
try {
String wellKnownName = wellKnownRenderings.get(iri);
if(wellKnownName != null) {
return wellKnownName;
}
String iriString = iri.toString();
for(Namespaces ns : Namespaces.values()) {
if(iriString.startsWith(ns.getPrefixIRI())) {
return ns.getPrefixName() + ":" + iriString.substring(ns.getPrefixIRI().length());
}
}
String fragment = getSubstringFromLastCharacter(iriString, '#');
if(fragment != null) {
return fragment;
}
String pathElement = getSubstringFromLastCharacter(iriString, '/');
if(pathElement != null) {
return pathElement;
}
return RenderingEscapeUtils.getEscapedRendering(iri.toQuotedString());
}
catch (Exception e) {
return "<Error! " + e.getMessage() + ">";
}
}
Protégé relies on this list when determining should a prefix be shown or not:
public enum Namespaces {
/** The OWL 2 namespace. */ OWL2 ("owl2", "http://www.w3.org/2006/12/owl2#", Status.LEGACY),
/** Status.LEGACY. */ OWL11XML ("owl11xml", "http://www.w3.org/2006/12/owl11-xml#", Status.LEGACY),
/** The OWL 1.1 namespace. */ OWL11 ("owl11", "http://www.w3.org/2006/12/owl11#", Status.LEGACY),
/**The OWL namespace. */ OWL ("owl", "http://www.w3.org/2002/07/owl#", IN_USE),
/**The RDFS namespace. */ RDFS ("rdfs", "http://www.w3.org/2000/01/rdf-schema#", IN_USE),
/** The RDF namespace. */ RDF ("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#", IN_USE),
/** The XSD namespace. */ XSD ("xsd", "http://www.w3.org/2001/XMLSchema#", IN_USE),
/** The XML namespace. */ XML ("xml", "http://www.w3.org/XML/1998/namespace"),
/** The SWRL namespace. */ SWRL ("swrl", "http://www.w3.org/2003/11/swrl#"),
/** The SWRLB namespace. */ SWRLB ("swrlb", "http://www.w3.org/2003/11/swrlb#"),
/** The SKOS namespace. */ SKOS ("skos", "http://www.w3.org/2004/02/skos/core#"),
// Further namespaces from the RDFa Core Initial Context
// http://www.w3.org/2011/rdfa-context/rdfa-1.1
/** The GRDDL namespace. */ GRDDL ("grddl", "http://www.w3.org/2003/g/data-view#"),
/** The MA namespace. */ MA ("ma", "http://www.w3.org/ns/ma-ont#"),
/** The PROV namespace. */ PROV ("prov", "http://www.w3.org/ns/prov#"),
/** The RDFA namespace. */ RDFA ("rdfa", "http://www.w3.org/ns/rdfa#"),
/** The RIF namespace. */ RIF ("rif", "http://www.w3.org/2007/rif#"),
/** The R2RML namespace. */ R2RML ("rr", "http://www.w3.org/ns/r2rml#"),
/** The SD namespace. */ SD ("sd", "http://www.w3.org/ns/sparql-service-description#"),
/** The SKOSXL namespace. */ SKOSXL ("skosxl", "http://www.w3.org/2008/05/skos-xl#"),
/** The POWDER namespace. */ POWDER ("wdr", "http://www.w3.org/2007/05/powder#"),
/** The VOID namespace. */ VOID ("void", "http://rdfs.org/ns/void#"),
/** The POWDERS namespace. */ POWDERS ("wdrs", "http://www.w3.org/2007/05/powder-s#"),
/** The XHV namespace. */ XHV ("xhv", "http://www.w3.org/1999/xhtml/vocab#"),
/** The ORG namespace. */ ORG ("org", "http://www.w3.org/ns/org#"),
/** The GLDP namespace. */ GLDP ("gldp", "http://www.w3.org/ns/people#"),
/** The CNT namespace. */ CNT ("cnt", "http://www.w3.org/2008/content#"),
/** The DCAT namespace. */ DCAT ("dcat", "http://www.w3.org/ns/dcat#"),
/** The EARL namespace. */ EARL ("earl", "http://www.w3.org/ns/earl#"),
/** The HT namespace. */ HT ("ht", "http://www.w3.org/2006/http#"),
/** The PTR namespace. */ PTR ("ptr", "http://www.w3.org/2009/pointers#"),
// Other widely used Semantic Web prefixes
/** The CC namespace. */ CC ("cc", "http://creativecommons.org/ns#"),
/** The CTAG namespace. */ CTAG ("ctag", "http://commontag.org/ns#"),
/** The DCTERMS namespace. */ DCTERMS ("dcterms", "http://purl.org/dc/terms/"),
/** The DC namespace. */ DC ("dc", "http://purl.org/dc/elements/1.1/"),
/** The FOAF namespace. */ FOAF ("foaf", "http://xmlns.com/foaf/0.1/"),
/** The GR namespace. */ GR ("gr", "http://purl.org/goodrelations/v1#"),
/** The ICAL namespace. */ ICAL ("ical", "http://www.w3.org/2002/12/cal/icaltzd#"),
/** The OG namespace. */ OG ("og", "http://ogp.me/ns#"),
/** The REV namespace. */ REV ("rev", "http://purl.org/stuff/rev#"),
/** The SIOC namespace. */ SIOC ("sioc", "http://rdfs.org/sioc/ns#"),
/** The VCARD namespace. */ VCARD ("vcard", "http://www.w3.org/2006/vcard/ns#"),
/** The SCHEMA namespace. */ SCHEMA ("schema", "http://schema.org/"),
/** The GEO namespace. */ GEO ("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#"),
/** The SC namespace. */ SC ("sc", "http://purl.org/science/owl/sciencecommons/"),
/** The FB namespace. */ FB ("fb", "http://rdf.freebase.com/ns/", Status.LEGACY),
/** The GEONAMES namespace. */ GEONAMES ("geonames", "http://www.geonames.org/ontology#", Status.LEGACY),
// DBpedia
/** The DBPEDIA namespace. */ DBPEDIA ("dbpedia", "http://dbpedia.org/resource/"),
/** The DBP namespace. */ DBP ("dbp", "http://dbpedia.org/property/"),
/** The DBO namespace. */ DBO ("dbo", "http://dbpedia.org/ontology/"),
/** The YAGO namespace. */ YAGO ("yago", "http://dbpedia.org/class/yago/");
//...
As you can see, foaf:
, dcterms:
and geo:
are included in this list, but bio:
is not.
For comparison, this is how rendering is performed when View > Render by prefixed name is selected:
public String render(IRI iri) {
try {
String s = prefixManager.getPrefixIRI(iri);
if (s != null) {
return s;
}
else {
// No mapping
return iri.toQuotedString();
}
}
catch (Exception e) {
return "<Error! " + e.getMessage() + ">";
}
}
Upvotes: 3