com.hp.hpl.jena.rdf.model.NodeIterator Java Examples

The following examples show how to use com.hp.hpl.jena.rdf.model.NodeIterator. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: OntologyBean.java    From LodView with MIT License 6 votes vote down vote up
private String getSingleValue(String preferredLanguage, Resource IRI, String prop, String defaultValue) {
	NodeIterator iter = model.listObjectsOfProperty(IRI, model.createProperty(prop));
	String result = defaultValue;
	boolean betterTitleMatch = false;
	while (iter.hasNext()) {
		RDFNode node = iter.nextNode();
		Literal l = node.asLiteral();
		//System.out.println(IRI + " " + preferredLanguage + " --> " + l.getLanguage() + " --> " + l.getLexicalForm());
		if (!betterTitleMatch && (result.equals(defaultValue) || l.getLanguage().equals("en") || l.getLanguage().equals(preferredLanguage))) {
			if (preferredLanguage.equals(l.getLanguage())) {
				betterTitleMatch = true;
			}
			result = l.getLexicalForm();
		}

	}
	return result;
}
 
Example #2
Source File: Mapping.java    From xcurator with Apache License 2.0 6 votes vote down vote up
public static Set<String> getAllTypes(Model model, String typePrefix) {
    Resource rootResource = model.createResource(typePrefix);

    com.hp.hpl.jena.rdf.model.Property classProperty = model.createProperty("http://dblab.cs.toronto.edu/project/xcurator/0.1#classes");
    Bag classBag = model.createBag("http://dblab.cs.toronto.edu/project/xcurator/0.1#classBag");
    model.add(rootResource, classProperty, classBag);

    Set<String> ret = new HashSet<String>();

    NodeIterator iterator = classBag.iterator();
    while (iterator.hasNext()) {
        Resource resource = (Resource) iterator.next();
        ret.add(resource.getURI());
    }

    return ret;
}
 
Example #3
Source File: ConceptualDomainRelationshipAssociationImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<ConceptualDomainResource> getRelatingConceptualDomainRelationships()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().relatingConceptualDomainRelationship);
	return mdrDatabase.getUtil().createList(it,
			ConceptualDomainResource.class);
}
 
Example #4
Source File: ConfigurationBean.java    From LodView with MIT License 5 votes vote down vote up
private Map<String, String> populateColorPairMatcher() {
	Map<String, String> result = new HashMap<String, String>();
	ResIterator iter = confModel.listSubjectsWithProperty(confModel.createProperty(confModel.getNsPrefixURI("conf"), "hasColorPair"));
	while (iter.hasNext()) {
		Resource res = iter.next();
		NodeIterator values = confModel.listObjectsOfProperty(res, confModel.createProperty(confModel.getNsPrefixURI("conf"), "hasColorPair"));
		while (values.hasNext()) {
			RDFNode node = values.next();
			result.put(res.toString(), node.toString());
			break;
		}
	}
	return result;
}
 
Example #5
Source File: ConceptualDomainRelationshipImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<ConceptualDomainRelationshipAssociationResource> getDescribingConceptualDomainRelationships()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().describingConceptualDomainRelationship);
	return mdrDatabase.getUtil().createList(it,
			ConceptualDomainRelationshipAssociationResource.class);
}
 
Example #6
Source File: ConceptImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
/**
 * 
 * @return {@link List} of all {@link Vocabulary#usedInConceptRelationship}
 *         property values
 * @throws MDRException
 */
@Override
public List<ConceptRelationshipResource> getUsedInConceptRelationships()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().usedInConceptRelationship);
	return mdrDatabase.getUtil().createList(it,
			ConceptRelationshipResource.class);
}
 
Example #7
Source File: ConfigurationBean.java    From LodView with MIT License 5 votes vote down vote up
private String getSingleConfValue(String prop, String defaultValue) {
	NodeIterator iter = confModel.listObjectsOfProperty(confModel.createProperty(confModel.getNsPrefixURI("conf"), prop));
	while (iter.hasNext()) {
		RDFNode node = iter.next();
		return node.toString();
	}
	return defaultValue;
}
 
Example #8
Source File: ConceptImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public ObjectClass getParentConcept() {
	NodeIterator l = this.listPropertyValues(RDFS.subClassOf);

	while (l.hasNext()) {
		RDFNode res = l.nextNode();
		if (res.canAs(OntClass.class)) {
			OntClass ontClass = res.as(OntClass.class);
			if (ontClass.hasSuperClass(mdrDatabase.getVocabulary().Concept)) {
				return new ConceptImpl(res.asResource(), mdrDatabase);
			}
		}
	}
	return null;
}
 
Example #9
Source File: RegistrationAuthorityImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<LanguageIdentificationResource> getDocumentationLanguageIdentifiers()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().documentationLanguageIdentifier);
	return mdrDatabase.getUtil().createList(it,
			LanguageIdentificationResource.class);
}
 
Example #10
Source File: NonEnumeratedConceptualDomainImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<NonEnumeratedValueDomainResource> getRepresentedByNonEnumeratedConceptualDomainRepresentations()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().representedByNonEnumeratedConceptualDomainRepresentation);
	return mdrDatabase.getUtil().createList(it,
			NonEnumeratedValueDomainResource.class);
}
 
Example #11
Source File: ConceptualDomainImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<ConceptualDomainRelationshipAssociationResource> getRelatedToConceptualDomainRelationships()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().relatedToConceptualDomainRelationship);
	return mdrDatabase.getUtil().createList(it,
			ConceptualDomainRelationshipAssociationResource.class);
}
 
Example #12
Source File: EnumeratedValueDomainImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PermissibleValueResource> getContainingPermissibleValueSets()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().containingPermissibleValueSet);
	return mdrDatabase.getUtil().createList(it,
			PermissibleValueResource.class);
}
 
Example #13
Source File: StewardshipRelationshipImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<AdministeredItemResource> getAdministratedItems()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().administeredItems);
	return mdrDatabase.getUtil().createList(it,
			AdministeredItemResource.class);
}
 
Example #14
Source File: TerminologicalEntryImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<LanguageSectionResource> getContaninigTerminologicalEntryLanguage()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().containingTerminologicalEntryLanguage);
	return mdrDatabase.getUtil().createList(it,
			LanguageSectionResource.class);
}
 
Example #15
Source File: TerminologicalEntryImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<AdministeredItemContextResource> getTerminologicalEntryAdministeredItemContext()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().terminologicalEntryAdministeredItemContext);
	return mdrDatabase.getUtil().createList(it,
			AdministeredItemContextResource.class);
}
 
Example #16
Source File: StewardshipImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<StewardshipRelationshipResource> getAdministers()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().administers);
	return mdrDatabase.getUtil().createList(it,
			StewardshipRelationshipResource.class);

}
 
Example #17
Source File: ConceptualDomainImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<DataElementConceptResource> getSpecifyingDataElementConceptConceptualDomainRelationships()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().specifyingDataElementConceptConceptualDomainRelationship);
	return mdrDatabase.getUtil().createList(it,
			DataElementConceptResource.class);
}
 
Example #18
Source File: OrganizationImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<StewardshipRelationshipResource> getAdministrating()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().administering);
	return mdrDatabase.getUtil().createList(it,
			StewardshipRelationshipResource.class);
}
 
Example #19
Source File: OrganizationImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<SubmissionRelationshipResource> getSubmitting()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().submitting);
	return mdrDatabase.getUtil().createList(it,
			SubmissionRelationshipResource.class);
}
 
Example #20
Source File: ValueDomainRelationshipImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<ValueDomainRelationshipAssociationResource> getDescribingValueDomainRelationships()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().describingValueDomainRelationship);
	return mdrDatabase.getUtil().createList(it,
			ValueDomainRelationshipAssociationResource.class);
}
 
Example #21
Source File: LanguageSectionImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<TerminologicalEntryResource> getPartitionings()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().partitioning);
	return mdrDatabase.getUtil().createList(it,
			TerminologicalEntryResource.class);
}
 
Example #22
Source File: ReferenceDocumentImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<LanguageIdentificationResource> getReferenceDocumentLanguageIdentifiers()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().referenceDocumentLanguageIdentifier);
	return mdrDatabase.getUtil().createList(it,
			LanguageIdentificationResource.class);
}
 
Example #23
Source File: DataElementConceptRelationshipAssociationImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<DataElementConceptResource> getRelatingDataElementConceptRelationships()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().relatingDataElementConceptRelationship);
	return mdrDatabase.getUtil().createList(it,
			DataElementConceptResource.class);
}
 
Example #24
Source File: ClassificationSchemeItemAssociationImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<ClassificationSchemeItemResource> getCSIAssociates()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().csiAssociates);
	return mdrDatabase.getUtil().createList(it,
			ClassificationSchemeItemResource.class);
}
 
Example #25
Source File: SubmissionRelationshipImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<AdministeredItemResource> getSubmittedItems()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().submittedItems);
	return mdrDatabase.getUtil().createList(it,
			AdministeredItemResource.class);
}
 
Example #26
Source File: SubmissionImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<SubmissionRelationshipResource> getSubmits()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().submits);
	return mdrDatabase.getUtil().createList(it,
			SubmissionRelationshipResource.class);
}
 
Example #27
Source File: ClassificationSchemeItemRelationshipImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<ClassificationSchemeItemAssociationImpl> getCSIRelationshipAssocations()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().csiRelationshipAssociation);
	return mdrDatabase.getUtil().createList(it,
			ClassificationSchemeItemAssociationImpl.class);
}
 
Example #28
Source File: PermissibleValueImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<EnumeratedValueDomainResource> getContainedInPermissibleValueSets()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().containedInPermissibleValueSet);
	return mdrDatabase.getUtil().createList(it,
			EnumeratedValueDomainResource.class);
}
 
Example #29
Source File: ValueMeaningImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<EnumeratedConceptualDomainResource> getContainedInValueMeaningSets()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().containedInValueMeaningSet);
	return mdrDatabase.getUtil().createList(it,
			EnumeratedConceptualDomainResource.class);
}
 
Example #30
Source File: ValueMeaningImpl.java    From semanticMDR with GNU General Public License v3.0 5 votes vote down vote up
@Override
public List<PermissibleValueResource> getUsedInPermissibleValueMeanings()
		throws MDRException {
	NodeIterator it = listPropertyValues(mdrDatabase.getVocabulary().usedInPermissibleValueMeaning);
	return mdrDatabase.getUtil().createList(it,
			PermissibleValueResource.class);
}