本文整理汇总了Java中org.semanticweb.owlapi.model.OWLAnnotationSubject类的典型用法代码示例。如果您正苦于以下问题:Java OWLAnnotationSubject类的具体用法?Java OWLAnnotationSubject怎么用?Java OWLAnnotationSubject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
OWLAnnotationSubject类属于org.semanticweb.owlapi.model包,在下文中一共展示了OWLAnnotationSubject类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getAllOWLObjectsByAltId
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
/**
* Find all corresponding {@link OWLObject}s with an OBO-style alternate identifier.
* <p>
* WARNING: This methods scans all object annotations in all ontologies.
* This is an expensive method.
*
* @return map of altId to OWLObject (never null)
*/
public Map<String, OWLObject> getAllOWLObjectsByAltId() {
final Map<String, OWLObject> results = new HashMap<String, OWLObject>();
final OWLAnnotationProperty altIdProperty = getAnnotationProperty(OboFormatTag.TAG_ALT_ID.getTag());
if (altIdProperty == null) {
return Collections.emptyMap();
}
for (OWLOntology o : getAllOntologies()) {
Set<OWLAnnotationAssertionAxiom> aas = o.getAxioms(AxiomType.ANNOTATION_ASSERTION);
for (OWLAnnotationAssertionAxiom aa : aas) {
OWLAnnotationValue v = aa.getValue();
OWLAnnotationProperty property = aa.getProperty();
if (altIdProperty.equals(property) && v instanceof OWLLiteral) {
String altId = ((OWLLiteral)v).getLiteral();
OWLAnnotationSubject subject = aa.getSubject();
if (subject instanceof IRI) {
OWLObject obj = getOWLObject((IRI) subject);
if (obj != null) {
results.put(altId, obj);
}
}
}
}
}
return results;
}
开发者ID:owlcollab,项目名称:owltools,代码行数:34,代码来源:OWLGraphWrapperExtended.java
示例2: getOWLObjectsByAltId
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
/**
* Find the corresponding {@link OWLObject}s for a given set of OBO-style alternate identifiers.
* <p>
* WARNING: This methods scans all object annotations in all ontologies.
* This is an expensive method.
* <p>
* Consider loading all altId-mappings using {@link #getAllOWLObjectsByAltId()}.
*
* @param altIds
* @return map of altId to OWLObject (never null)
* @see #getAllOWLObjectsByAltId()
*/
public Map<String, OWLObject> getOWLObjectsByAltId(Set<String> altIds) {
final Map<String, OWLObject> results = new HashMap<String, OWLObject>();
final OWLAnnotationProperty altIdProperty = getAnnotationProperty(OboFormatTag.TAG_ALT_ID.getTag());
if (altIdProperty == null) {
return Collections.emptyMap();
}
for (OWLOntology o : getAllOntologies()) {
Set<OWLAnnotationAssertionAxiom> aas = o.getAxioms(AxiomType.ANNOTATION_ASSERTION);
for (OWLAnnotationAssertionAxiom aa : aas) {
OWLAnnotationValue v = aa.getValue();
OWLAnnotationProperty property = aa.getProperty();
if (altIdProperty.equals(property) && v instanceof OWLLiteral) {
String altId = ((OWLLiteral)v).getLiteral();
if (altIds.contains(altId)) {
OWLAnnotationSubject subject = aa.getSubject();
if (subject instanceof IRI) {
OWLObject obj = getOWLObject((IRI) subject);
if (obj != null) {
results.put(altId, obj);
}
}
}
}
}
}
return results;
}
开发者ID:owlcollab,项目名称:owltools,代码行数:40,代码来源:OWLGraphWrapperExtended.java
示例3: mergeOntology
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
public void mergeOntology(OWLOntology extOnt, LabelPolicy labelPolicy) throws OWLOntologyCreationException {
OWLOntologyManager manager = getManager();
LOG.info("Merging "+extOnt+" policy: "+labelPolicy);
for (OWLAxiom axiom : extOnt.getAxioms()) {
if (labelPolicy != LabelPolicy.ALLOW_DUPLICATES) {
if (axiom instanceof OWLAnnotationAssertionAxiom) {
OWLAnnotationAssertionAxiom aa = (OWLAnnotationAssertionAxiom)axiom;
if (aa.getProperty().isLabel()) {
OWLAnnotationSubject subj = aa.getSubject();
if (subj instanceof IRI) {
Optional<OWLLiteral> label = null;
for (OWLAnnotationAssertionAxiom a1 : sourceOntology.getAnnotationAssertionAxioms(subj)) {
if (a1.getProperty().isLabel()) {
label = a1.getValue().asLiteral();
}
}
if (label != null && label.isPresent()) {
if (labelPolicy == LabelPolicy.PRESERVE_SOURCE) {
LOG.info("Preserving existing label:" +subj+" "+label+" // ditching: "+axiom);
continue;
}
if (labelPolicy == LabelPolicy.PRESERVE_EXT) {
LOG.info("Replacing:" +subj+" "+label+" with: "+axiom);
LOG.error("NOT IMPLEMENTED");
}
}
}
}
}
}
manager.applyChange(new AddAxiom(sourceOntology, axiom));
}
for (OWLImportsDeclaration oid: extOnt.getImportsDeclarations()) {
manager.applyChange(new AddImport(sourceOntology, oid));
}
addCommentToOntology(sourceOntology, "Includes "+summarizeOntology(extOnt));
}
开发者ID:owlcollab,项目名称:owltools,代码行数:38,代码来源:OWLGraphWrapperBasic.java
示例4: printRelations
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
/**
* Print out RelEx relations. All relations shown
* in a binary form.
*
* Example:
* _subj(throw, John)
* _obj(throw, ball)
* tense(throw, past)
* definite-FLAG(ball, T)
* noun_number(ball, singular)
*/
public void printRelations(ParsedSentence parse, String sentence, int sentence_id, String ontologyname)
{
try
{
sent = sentence;
//Add the sentence to Sentence Class
this.sentence_id = sentence_id;
sentenceInd = factory.getOWLNamedIndividual(IRI.create(ontologyURI + "#" + "sentence_" + sentence_id));
//OWLAnnotationProperty p = new OWLAnnotationPropertyImpl(IRI.create(sentence));
//OWLAnnotation label = factory.getOWLAnnotation(sentence);
OWLOntologyFormat ontologyFormat = manager.getOntologyFormat(ontology);
OWLAnnotation label = (OWLAnnotation) factory.getOWLAnnotationProperty(sentence, (PrefixManager) ontologyFormat);
OWLClassAssertionAxiom sentClass = factory.getOWLClassAssertionAxiom(this.sentence,sentenceInd);
OWLAnnotationAssertionAxiom labelClass = factory.getOWLAnnotationAssertionAxiom((OWLAnnotationSubject) sentClass, label);
manager.applyChange(new AddAxiom(ontology, sentClass));
manager.applyChange(new AddAxiom(ontology, labelClass));
printRelations(parse, null);
}
catch (OWLOntologyChangeException ex)
{
Logger.getLogger(OWLView.class.getName()).log(Level.SEVERE, null, ex);
}
}
开发者ID:opencog,项目名称:relex,代码行数:40,代码来源:OWLView.java
示例5: OWLAnnotationAssertionAxiomImpl
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
/**
* @param subject
* subject for axiom
* @param property
* annotation property
* @param value
* annotation value
* @param annotations
* annotations on the axiom
*/
public OWLAnnotationAssertionAxiomImpl(
@Nonnull OWLAnnotationSubject subject,
@Nonnull OWLAnnotationProperty property,
@Nonnull OWLAnnotationValue value,
@Nonnull Collection<? extends OWLAnnotation> annotations) {
super(annotations);
this.subject = checkNotNull(subject, "subject cannot be null");
this.property = checkNotNull(property, "property cannot be null");
this.value = checkNotNull(value, "value cannot be null");
}
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:21,代码来源:OWLAnnotationAssertionAxiomImpl.java
示例6: initialiseIndividualsView
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
public void initialiseIndividualsView() throws Exception {
list = new OWLFrameList<OWLAnnotationSubject>(getOWLEditorKit(), new SKOSAnnotationFrame(getOWLEditorKit()));
setLayout(new BorderLayout());
add(new JScrollPane(list));
}
开发者ID:simonjupp,项目名称:skoseditor,代码行数:6,代码来源:SKOSAnnotationViewComponent.java
示例7: convert
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
@SuppressWarnings("static-method")
public ElkAnnotationSubject convert(OWLAnnotationSubject subject) {
return OWL_ANNOTATION_CONVERTER.visit(subject);
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:5,代码来源:OwlConverter.java
示例8: visit
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
public ElkAnnotationSubject visit(OWLAnnotationSubject subject) {
return subject.accept(this);
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:4,代码来源:OwlAnnotationSubjectValueVisitor.java
示例9: convert
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
@Override
public OWLAnnotationSubject convert(ElkAnnotationSubject input) {
return (OWLAnnotationSubject) input.accept(this);
}
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:5,代码来源:ElkConverter.java
示例10: setup
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
@Before
public void setup() throws Exception {
if (builtGraph) {
// TODO: UGH - need a better pattern for this
return;
}
graph = createInstance();
String uri = Resources.getResource("ontologies/family.owl").toURI().toString();
manager.loadOntologyFromOntologyDocument(IRI.create(uri));
List<MappedProperty> propertyMap = new ArrayList<>();
MappedProperty age = mock(MappedProperty.class);
when(age.getName()).thenReturn("isAged");
when(age.getProperties()).thenReturn(newArrayList(ROOT + "/hasAge"));
propertyMap.add(age);
MappedProperty versionInfo = mock(MappedProperty.class);
when(versionInfo.getName()).thenReturn("versionInfo");
when(versionInfo.getProperties()).thenReturn(newArrayList(OWL + "versionInfo"));
propertyMap.add(versionInfo);
OWLOntologyWalker walker = new OWLOntologyWalker(manager.getOntologies());
GraphOwlVisitor visitor = new GraphOwlVisitor(walker, graph, propertyMap);
walker.walkStructure(visitor);
for (OWLOntology ontology : manager.getOntologies()){
String ontologyIri = OwlApiUtils.getIri(ontology);
for (OWLAnnotation annotation : ontology.getAnnotations()) { // Get annotations on ontology iri
OWLAnnotationSubject ontologySubject = IRI.create(ontologyIri);
OWLAnnotationAssertionAxiom object =
new OWLAnnotationAssertionAxiomImpl(ontologySubject,
annotation.getProperty(), annotation.getValue(),
new ArrayList<OWLAnnotation>());
visitor.visit(object);
}
}
graph.shutdown();
graphDb = new TestGraphDatabaseFactory().newEmbeddedDatabase(new File(path));
tx = graphDb.beginTx();
nodeIndex = graphDb.index().getNodeAutoIndexer().getAutoIndex();
builtGraph = true;
}
开发者ID:SciGraph,项目名称:SciGraph,代码行数:42,代码来源:GraphOwlVisitorTestBase.java
示例11: getSubject
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
@Override
public OWLAnnotationSubject getSubject() {
return subject;
}
开发者ID:matthewhorridge,项目名称:owlapi-gwt,代码行数:5,代码来源:OWLAnnotationAssertionAxiomImpl.java
示例12: main
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
/**
* @param args
*/
public static void main(String[] args) {
OWLOntologyManager manager = OWLManager.createOWLOntologyManager();
IRI iri = IRI.create(new File("/Users/ralph/Uni/Corporate Semantic Web/Arbeitspaket SVoNt/runtime-EclipseApplication/ChangelogTest4/ontology/ontology.owl"));
try {
OWLOntology ontology = manager.loadOntologyFromOntologyDocument(iri);
IRI ontologyIRI = ontology.getOntologyID().getOntologyIRI();
System.out.println(ontologyIRI);
System.out.println();
Set<OWLEntity> entities = ontology.getSignature();
for (OWLEntity entity : entities) {
System.out.println(entity + ":");
Set<OWLAnnotationAssertionAxiom> axioms = entity.getAnnotationAssertionAxioms(ontology);
for (OWLAnnotationAssertionAxiom axiom : axioms) {
System.out.print(axiom.getClass().getName()+": ");
System.out.print(axiom.getAxiomType() + ", ");
System.out.println(axiom);
OWLAnnotationSubject subject = axiom.getSubject();
if (subject instanceof IRI) {
Set<OWLEntity> subjects = ontology.getEntitiesInSignature((IRI)subject);
if (subjects.size() != 1) {
System.out.println("Ooops, subject size is " + subjects.size());
} else {
OWLEntity subjectEntity = subjects.iterator().next();
System.out.println(subjectEntity);
}
}
System.out.println();
}
System.out.println();
}
} catch (OWLOntologyCreationException e) {
e.printStackTrace();
}
}
开发者ID:ag-csw,项目名称:SVoNt,代码行数:48,代码来源:Test.java
示例13: convert
import org.semanticweb.owlapi.model.OWLAnnotationSubject; //导入依赖的package包/类
abstract OWLAnnotationSubject convert(ElkAnnotationSubject input);
开发者ID:liveontologies,项目名称:elk-reasoner,代码行数:2,代码来源:AbstractElkObjectConverter.java
注:本文中的org.semanticweb.owlapi.model.OWLAnnotationSubject类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论