add attribute to skos altLabel

40 views
Skip to first unread message

Szabolcs Révész

unread,
Feb 1, 2011, 9:10:53 AM2/1/11
to skos...@googlegroups.com
Hi,

I have just worked with skos api and I do not find the answer my problem.
I would like to add a new attribute to the altLabel, e.g.:
<skos:altLabel xml:lang="en" myNameSpace:related="0.8">some alt label</skos:altLabel>

Is it possible?

Thanks,
Szabolcs

Simon Jupp

unread,
Feb 1, 2011, 10:00:58 AM2/1/11
to skos...@googlegroups.com
Hi Szabolcs,

You won't be able to assert this attribute like this using OWL or
SKOS. I would suggest using an OWL axiom annotation.

This isn't very well supported by the SKOS API, but it is possible,
You will need do this via the OWL API (that you should already be able
to access from the SKOS API).

Here is an example that I hope you can follow:

// get your SKOS altLabel assertion

SKOSDataRelationAssertion assertion =
factory.getSKOSDataRelationAssertion(concept,
factory.getSKOSAltLabelProperty(), "Another Label", "en");

// you need to turn this into an OWL Axiom, you can do this by casting
it to it's implementation

SKOSDataRelationAssertionImpl impl = (SKOSDataRelationAssertionImpl) assertion;
OWLDataPropertyAssertionAxiom owlAxiom = impl.getAssertionAxiom();

// now get the OWL API manager and data factory

OWLOntologyManager owlManager = skosManager.getOWLManger();
OWLDataFactory owlFact = owlManager.getOWLDataFactory();

// create the annotation axiom

OWLAnnotation anno =
owlFact.getOWLConstantAnnotation(URI.create("http://myNamespace#related")
, owlFact.getOWLUntypedConstant("0.8"));
OWLAxiomAnnotationAxiom owlAxiomAnno =
owlFact.getOWLAxiomAnnotationAxiom(owlAxiom, anno);

// then add the axiom to your SKOS vocabulary
SKOStoOWLConverter converter = new SKOStoOWLConverter();
owlMan.applyChange(new
AddAxiom(converter.getAsOWLOntology(yourSKOSvocab), owlAxiomAnno ));

The resulting RDF is something like this:

<rdf:Description>
<rdf:type rdf:resource="&http;www.w3.org/2002/07/owl#Axiom"/>
<rdf:subject rdf:resource="concept2"/>
<rdf:predicate
rdf:resource="&http;www.w3.org/2004/02/skos/core#altLabel"/>
<rdf:object xml:lang="en">Another Label</rdf:object>
<myNamespace:related>0.8</myNamespace:related>
</rdf:Description>

Hope that helps

Simon

2011/2/1 Szabolcs Révész <szre...@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups
> "skos-dev" group.
> To post to this group, send email to skos...@googlegroups.com.
> To unsubscribe from this group, send email to
> skos-dev+u...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/skos-dev?hl=en.
>

Reply all
Reply to author
Forward
0 new messages