Namespace support

0 views
Skip to first unread message

Brad Cox

unread,
Jun 15, 2014, 8:35:22 AM6/15/14
to sta...@clarkparsia.com
I'm a new stardog user. Quite impressed so far but having some trouble with basic questions and a bit confused, especially insofar as skos: support and how namespaces are being handled.

I've a java program that converts a geonames .csv file to (what I believe is) valid turtle (more or less) and importing it via the batch command-line interface. Here's a snippet of the import file:

@prefix base: <http://dtra.mil/LocationOntology> .
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
@prefix owl: <http://www.w3.org/2002/07/owl#> .
@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
@prefix skos: <http://www.w3.org/2004/02/skos/core#> .
@prefix dc: <http://purl.org/dc/elements/1.1/#> .
@prefix geo: <http://www.w3.org/2003/01/geo/wgs84_pos#> .
@prefix dtra: <http://dtra.mil/LocationOntology#> .

<dtra:LocationOntology> a <owl:Ontology> ;
<owl:imports> <http://www.w3.org/2008/05/skos> , <http://www.w3.org/2003/01/geo/wgs84_pos> , <http://www.w3.org/2002/07/owl> .

<dtra:LocationScheme> a <skos:ConceptScheme> ;
<skos:prefLabel> "Locations" ;
<skos:altLabel> "Places" ;
<skos:inScheme> <dtra:LocationScheme> .

<dtra:Location> a <skos:TopConcept> ;
<skos:prefLabel> "Location" ;
<skos:altLabel> "Place" ;
<skos:inScheme> <dtra:LocationScheme> ;
<rdfs:subClassOf> <skos:Concept> ;
<rdfs:comment> "The class of locations/places from geonames.org" .

<dtra:City> a <dtra:Location> ;
<skos:prefLabel> "City" ;
<skos:altLabel> "Village" , "Town" ;
<skos:inScheme> <dtra:LocationScheme> ;
<rdfs:subClassOf> <dtra:Location> ;
<rdfs:comment> "The class of cities, towns or villages from geonames.org." ;
<skos:broader> <dtra:County> ;
<rdfs:label> "City" .

<dtra:County> a <dtra:Location> ;
<skos:prefLabel> "County" ;
<skos:inScheme> <dtra:LocationScheme> ;
<rdfs:subClassOf> <dtra:Location> ;
<rdfs:comment> "The class of counties from geonames.org." ;
<skos:broader> <dtra:State> ;
<rdfs:label> "County" .

<dtra:State> a <dtra:Location> ;
<skos:prefLabel> "State" ;
<skos:altLabel> "Province" ;
<skos:inScheme> <dtra:LocationScheme> ;
<rdfs:subClassOf> <dtra:Location> ;
<rdfs:comment> "The class of states or provinces from geonames.org" ;
<skos:broader> <dtra:Country> ;
<rdfs:label> "State" .

<dtra:Country> a <dtra:Location>;
<skos:prefLabel> "Country" ;
<skos:altLabel> "Nation" ;
<skos:inScheme> <dtra:LocationScheme> ;
<rdfs:subClassOf> <dtra:Location> ;
<rdfs:comment> """The class of countries/nations from geonames.org
Name not provided by geonames but is derived via 
lookup from a build-in table of iso country codes.""" ;
<skos:broader> <dtra:Location> , <dtra:Chilpancingo_de_los_Bravo> , <dtra:El_Mante> ;
<rdfs:label> "Country" .

<dtra:Community> a <dtra:Location> ;
<skos:prefLabel> "Community" ;
<skos:inScheme> <dtra:LocationScheme> ;
<rdfs:subClassOf> <dtra:Location> ;
<rdfs:comment> """The class of communities as the term is used by geonames.org.""" ; 
<skos:broader> <dtra:Country> ;
<rdfs:label> "Community" .

<dtra:hasCode> a <owl:DatatypeProperty> ;
<rdfs:comment> "Postal code as used by geonames.org" .

<dtra:hasCounty> a <owl:ObjectProperty> ;
<rdfs:comment> "County as used by geonames.org" .
<dtra:hasState> a <owl:ObjectProperty> ;
<rdfs:comment> "State or Province as used by geonames.org" .
<dtra:hasCommunity> a <owl:ObjectProperty> ;
<rdfs:comment> "Community as used by geonames.org" .

<dtra:hasCountry> a <owl:ObjectProperty> ;
<rdfs:comment> "Country as used by geonames.org" .


<dtra:City_AD100> a <dtra:City> ;
<skos:prefLabel> "Canillo" ;
<geo:lat> "42.5833"^^<xsd:double> ;
<geo:long> "1.6667"^^<xsd:double> ;
<dtra:hasCountry> <dtra:Country_AD> ;
<dtra:hasCode> "AD100"^^<xsd:string> .
<dtra:Country_AD> a <dtra:Country> ;
<skos:prefLabel> "Andorra" ;
<dtra:hasCode> "AD"^^<xsd:string> .

But when I have stardog export the database as turtle, I get this; minus the@prefix information. Although namespaces are used in the body, there's no indication that namespaces are actually defined.

<dtra:LocationOntology> a <owl:Ontology> ;
<owl:imports> <http://www.w3.org/2008/05/skos> , <http://www.w3.org/2003/01/geo/wgs84_pos> , <http://www.w3.org/2002/07/owl> .

<dtra:LocationScheme> a <skos:ConceptScheme> ;
<dc:title> "DTRA Location Scheme" ;
<dc:description> "DTRA Location Thesaurus based on geonames.org" ;
<dc:creator> "Brad Cox" ;
<skos:prefLabel> "Locations" ;
<skos:altLabel> "Places" ;
<skos:inScheme> <dtra:LocationScheme> .

<dtra:Location> a <skos:TopConcept> ;
<skos:prefLabel> "Location" ;
<skos:altLabel> "Place" ;
<skos:inScheme> <dtra:LocationScheme> ;
<rdfs:subClassOf> <skos:Concept> ;
<rdfs:comment> "The class of locations/places from geonames.org" .

<dtra:City> a <dtra:Location> ;
<skos:prefLabel> "City" ;
<skos:altLabel> "Village" , "Town" ;
<skos:inScheme> <dtra:LocationScheme> ;
<rdfs:subClassOf> <dtra:Location> ;
<rdfs:comment> "The class of cities, towns or villages from geonames.org." ;
 Can someone get me on the right path? Are those namespaces really in effect?

I'm also uncertain about owl/skos integration, especially about the relation between owl instances and skos classes (and/or instances). As far I know, skos doesn't support instances (only concepts), but the dox leave me uncertain about this. So I'm exploring...

Jerven Bolleman

unread,
Jun 16, 2014, 3:26:53 AM6/16/14
to sta...@clarkparsia.com
Hi Brad,

Disclaimer: I am not a stardog developer or in any way related to clark and parsia.

While your turtle file is valid. It does not encode what it thinks you wrote.

Every time you write
<skos:ConceptScheme> you should have written just skos:ConceptScheme without the the angle brackets.
In other words when using prefixes don't write brackets.

I will let more knowledgeable people respond on the question of OWL and SKOS overlap.

Regards,
Jerven

Rob Vesse

unread,
Jun 16, 2014, 4:10:13 AM6/16/14
to sta...@clarkparsia.com
Brad

You've made a subtle error in your data, putting  < > around everything means they are treated as URIs rather than prefixed names.  Since Turtle prefixed name syntax matches the URI generic syntax Stardog (or any RDF system for that matter) happily accepts and treats them as URIs.  So your data is valid Turtle as you suggest but it does not encode the data you think it does.

What I mean by this is that when you've written <skos:prefLabel> rather than getting the URI http://www.w3.org/2004/02/skos/core#prefLabel what you actually got was the URI skos:prefLabel

Removing the < > around your prefixed names will resolve the problem e.g.

dtra:LocationScheme a skos:ConceptScheme ;
skos:prefLabel "Locations" ;
skos:altLabel "Places" ;
skos:inScheme dtra:LocationScheme .


Hope this helps,

Rob

--
-- --
You received this message because you are subscribed to the C&P "Stardog" group.
To post to this group, send email to sta...@clarkparsia.com
To unsubscribe from this group, send email to
stardog+u...@clarkparsia.com
For more options, visit this group at
http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

To unsubscribe from this group and stop receiving emails from it, send an email to stardog+u...@clarkparsia.com.
Reply all
Reply to author
Forward
0 new messages