2017-08-19 5 views
1

Quelqu'un pourrait-il expliquer pourquoi Protégé (5.2) ajoute un préfixe à certaines classes et à d'autres non? La vue est définie sur un nom IRI court. Je vois foaf:Agent, dcterm:Agent ou geo:SpatialThing. Mais pas bio:Event, seulement Event!Le préfixe n'est pas toujours affiché dans certaines importations d'ontologie dans Protege.

Voici l'ontologie:

@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 

Répondre

1

Si vous voulez voir préfixes, sélectionnez Affichage> Rendu par nom préfixé.
Vous devriez peut-être entrer ces préfixes sur Active Ontology> Ontology prefixes en premier.

La question doit être la suivante: pourquoi les préfixes sont-ils affichés même lorsque Affichage> Rendu par entité Nom abrégé IRI est sélectionné.

Il semble étrange, mais selon le source code, protège devrait vraiment afficher certains préfixes même au nom court mode de rendu:

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é repose sur this list pour déterminer si un préfixe affiché ou non:

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/"); 
//... 

Comme vous pouvez le voir, foaf:, dcterms: et geo: sont inclus dans cette liste, mais bio: n'est pas.


À titre de comparaison, c'est how rendu est effectué lorsque Affichage> Rendu par nom préfixé est sélectionné:

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() + ">"; 
    } 
} 
+0

Je vois, est logique. Je vous remercie. – theChaosCoder