本文整理汇总了Java中com.hp.hpl.jena.util.iterator.ExtendedIterator.next方法的典型用法代码示例。如果您正苦于以下问题:Java ExtendedIterator.next方法的具体用法?Java ExtendedIterator.next怎么用?Java ExtendedIterator.next使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.hp.hpl.jena.util.iterator.ExtendedIterator
的用法示例。
在下文中一共展示了ExtendedIterator.next方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getAllClasses
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public static List<String> getAllClasses ()
{
List<String>classes = new ArrayList<String>();
DrbCortexModel model;
try
{
model = DrbCortexModel.getDefaultModel();
}
catch (IOException e)
{
return classes;
}
ExtendedIterator it= model.getCortexModel().getOntModel().listClasses();
while (it.hasNext())
{
OntClass cl = (OntClass)it.next();
String uri = cl.getURI();
if (uri!=null)
classes.add(uri);
}
return classes;
}
示例2: getProduct
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public static Product getProduct(Node subject,Graph graph,HashMap<Node,Product> hashmap){
Product product=hashmap.get(subject);
if (product!=null){
return product;
}
else{
product=new Product();
ExtendedIterator<Node> compositions=GraphUtil.listSubjects(graph,RELATING_OBJECT,subject);
if(compositions.hasNext()){
ExtendedIterator<Node> childIterator=GraphUtil.listObjects(graph,compositions.next(),RELATED_OBJECTS);
while (childIterator.hasNext()){
Node childNode=childIterator.next();
Product child=hashmap.get(childNode);
if (child!=null){
product.getTriangles().addAll(child.getTriangles());
}
else{
child=getProduct(childNode,graph,hashmap);
product.getTriangles().addAll(child.getTriangles());
}
}
}
return product;
}
}
示例3: extractResourceURIs
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private <T> List<String> extractResourceURIs(final ExtendedIterator<T> iterator, final Set<String> namespaces) {
try {
final List<String> uris=Lists.newLinkedList();
while(iterator.hasNext()) {
final T item=iterator.next();
if(item instanceof Resource) {
final Resource resource = (Resource)item;
if(!resource.isAnon()) {
final String uri = resource.getURI();
if(!isReserved(uri)) {
if(namespaces.contains(resource.getNameSpace())) {
uris.add(uri);
}
}
}
}
}
return uris;
} finally {
iterator.close();
}
}
示例4: loadStdLicenseIDs
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
static void loadStdLicenseIDs() {
STANDARD_LICENSES = new HashMap<String, SPDXStandardLicense>();
try {
Model stdLicenseModel = getStandardLicenseModel();
Node p = stdLicenseModel.getProperty(SpdxRdfConstants.SPDX_NAMESPACE, SpdxRdfConstants.PROP_LICENSE_ID).asNode();
Triple m = Triple.createMatch(null, p, null);
ExtendedIterator<Triple> tripleIter = stdLicenseModel.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
STANDARD_LICENSE_ID_SET.add(t.getObject().toString(false));
}
} catch (Exception ex) {
logger.warn("Error loading standard license ID's from model. Using static standard license ID's");
for (int i = 0; i < STANDARD_LICENSE_IDS.length; i++) {
STANDARD_LICENSE_ID_SET.add(STANDARD_LICENSE_IDS[i]);
}
}
// logger.info("Loaded STANDARD_LICENSE_ID_SET size = " + STANDARD_LICENSE_ID_SET.size());
}
示例5: getExtractedLicenseInfos
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
* @return the nonStandardLicenses
* @throws InvalidSPDXAnalysisException
*/
public SPDXNonStandardLicense[] getExtractedLicenseInfos() throws InvalidSPDXAnalysisException {
// nonStandardLicenses
Node spdxDocNode = getSpdxDocNode();
if (spdxDocNode == null) {
throw(new InvalidSPDXAnalysisException("No SPDX Document - can not get the Non Standard Licenses"));
}
ArrayList<SPDXNonStandardLicense> alLic = new ArrayList<SPDXNonStandardLicense>();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_NONSTANDARD_LICENSES).asNode();
Triple m = Triple.createMatch(spdxDocNode, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
alLic.add(new SPDXNonStandardLicense(model, t.getObject()));
}
SPDXNonStandardLicense[] nonStandardLicenses = new SPDXNonStandardLicense[alLic.size()];
nonStandardLicenses = alLic.toArray(nonStandardLicenses);
return nonStandardLicenses;
}
示例6: getDeclaredLicense
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
* @return the declaredLicenses
* @throws InvalidSPDXAnalysisException
*/
public SPDXLicenseInfo getDeclaredLicense() throws InvalidSPDXAnalysisException {
ArrayList<SPDXLicenseInfo> alLic = new ArrayList<SPDXLicenseInfo>();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_DECLARED_LICENSE).asNode();
Triple m = Triple.createMatch(this.node, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
alLic.add(SPDXLicenseInfoFactory.getLicenseInfoFromModel(model, t.getObject()));
}
if (alLic.size() > 1) {
throw(new InvalidSPDXAnalysisException("Too many declared licenses"));
}
if (alLic.size() == 0) {
return null;
}
return alLic.get(0);
}
示例7: getConcludedLicenses
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
* @return the detectedLicenses
* @throws InvalidSPDXAnalysisException
*/
public SPDXLicenseInfo getConcludedLicenses() throws InvalidSPDXAnalysisException {
ArrayList<SPDXLicenseInfo> alLic = new ArrayList<SPDXLicenseInfo>();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_PACKAGE_CONCLUDED_LICENSE).asNode();
Triple m = Triple.createMatch(this.node, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
alLic.add(SPDXLicenseInfoFactory.getLicenseInfoFromModel(model, t.getObject()));
}
if (alLic.size() > 1) {
throw(new InvalidSPDXAnalysisException("Too many concluded licenses"));
}
if (alLic.size() == 0) {
return null;
}
return alLic.get(0);
}
示例8: getDataLicense
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public SPDXStandardLicense getDataLicense() throws InvalidSPDXAnalysisException {
ArrayList<SPDXLicenseInfo> alLic = new ArrayList<SPDXLicenseInfo>();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_DATA_LICENSE).asNode();
Triple m = Triple.createMatch(getSpdxDocNode(), p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
alLic.add(SPDXLicenseInfoFactory.getLicenseInfoFromModel(model, t.getObject()));
}
if (alLic.size() > 1) {
throw(new InvalidSPDXAnalysisException("Too many data licenses"));
}
if (alLic.size() == 0) {
return null;
}
if (!(alLic.get(0) instanceof SPDXStandardLicense)) {
throw(new InvalidSPDXAnalysisException("Incorrect license for datalicense - must be a standard SPDX license type"));
}
return (SPDXStandardLicense)(alLic.get(0));
}
示例9: getCreatorInfo
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public SPDXCreatorInformation getCreatorInfo() throws InvalidSPDXAnalysisException {
Node spdxDocNode = getSpdxDocNode();
if (spdxDocNode == null) {
throw(new InvalidSPDXAnalysisException("No SPDX Document was found. Can not access the creator information"));
}
ArrayList<SPDXCreatorInformation> als = new ArrayList<SPDXCreatorInformation>();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_CREATION_INFO).asNode();
Triple m = Triple.createMatch(spdxDocNode, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
als.add(new SPDXCreatorInformation(model, t.getObject()));
}
if (als.size() > 1) {
throw(new InvalidSPDXAnalysisException("Too many creation information for document. Only one is allowed."));
}
if (als.size() > 0) {
return als.get(0);
} else {
return null;
}
}
示例10: getReviewers
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
* @return the reviewers
* @throws InvalidSPDXAnalysisException
*/
public SPDXReview[] getReviewers() throws InvalidSPDXAnalysisException {
Node spdxDocNode = getSpdxDocNode();
if (spdxDocNode == null) {
throw(new InvalidSPDXAnalysisException("Must have an SPDX document to get reviewers"));
}
ArrayList<SPDXReview> als = new ArrayList<SPDXReview>();
als.clear();
Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_REVIEWED_BY).asNode();
Triple m = Triple.createMatch(spdxDocNode, p, null);
ExtendedIterator<Triple >tripleIter = model.getGraph().find(m);
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
als.add(new SPDXReview(model, t.getObject()));
}
SPDXReview[] reviewers = new SPDXReview[als.size()];
reviewers = als.toArray(reviewers);
return reviewers;
}
示例11: getSpdxPackage
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
/**
* @return the spdxPackage
* @throws InvalidSPDXAnalysisException
*/
public SPDXPackage getSpdxPackage() throws InvalidSPDXAnalysisException {
if (this.spdxPackage != null) {
return this.spdxPackage;
}
Node spdxDocNode = getSpdxDocNode();
if (spdxDocNode == null) {
throw(new InvalidSPDXAnalysisException("Must set an SPDX doc before getting an SPDX package"));
}
Node p = model.getProperty(SPDX_NAMESPACE, PROP_SPDX_PACKAGE).asNode();
Triple m = Triple.createMatch(spdxDocNode, p, null);
ExtendedIterator<Triple> tripleIter = model.getGraph().find(m);
SPDXPackage newSpdxPackage = null;
while (tripleIter.hasNext()) {
Triple t = tripleIter.next();
newSpdxPackage = new SPDXPackage(t.getObject());
}
this.spdxPackage = newSpdxPackage;
return newSpdxPackage;
}
示例12: getImports
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public synchronized Map<String, String> getImports(String publicUri, Scope scope) throws ConfigurationException, IOException {
OntModel theModel = getOntModel(publicUri, scope);
if (theModel != null) {
Ontology onto = theModel.getOntology(publicUri);
if (onto != null) {
ExtendedIterator<OntResource> importsItr = onto.listImports();
if (importsItr.hasNext()) {
Map<String, String> map = new HashMap<String, String>();
while (importsItr.hasNext()) {
OntResource or = importsItr.next();
String importUri = or.toString();
String prefix = theModel.getNsURIPrefix(importUri);
if (prefix == null) {
prefix = getGlobalPrefix(importUri);
}
logger.debug("Ontology of model '" + publicUri + "' has import '" + importUri + "' with prefix '" + prefix + "'");
if (!map.containsKey(importUri)) {
map.put(importUri, prefix);
}
}
return map;
}
}
}
return Collections.emptyMap();
}
示例13: getUnionClassRangeString
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private String getUnionClassRangeString(UnionClass unionClass) {
String rslt = "";
int cnt = 0;
RDFList uclsses = unionClass.getOperands();
if (uclsses != null) {
ExtendedIterator<RDFNode> eitr = uclsses.iterator();
while (eitr.hasNext()) {
RDFNode node = eitr.next();
if (cnt > 0) rslt += " or ";
if (node.canAs(OntClass.class)) {
rslt += ontClassToString(node.as(OntClass.class), null);
}
cnt++;
}
if (cnt > 1) {
rslt = "{" + rslt + "}";
}
}
return rslt;
}
示例14: getSadlTypedListType
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
public Resource getSadlTypedListType(OntClass lstcls) {
ExtendedIterator<OntClass> eitr = ((OntClass)lstcls.as(OntClass.class)).listSuperClasses(true);
while (eitr.hasNext()) {
OntClass cls = eitr.next();
if (cls.isRestriction()) {
if (cls.canAs(AllValuesFromRestriction.class)) {
if (((AllValuesFromRestriction)cls.as(AllValuesFromRestriction.class)).onProperty(theJenaModel.getProperty(SadlConstants.SADL_LIST_MODEL_FIRST_URI))) {
Resource avf = ((AllValuesFromRestriction)cls.as(AllValuesFromRestriction.class)).getAllValuesFrom();
eitr.close();
return avf;
}
}
}
}
return null;
}
示例15: addListValues
import com.hp.hpl.jena.util.iterator.ExtendedIterator; //导入方法依赖的package包/类
private void addListValues(Individual inst, OntClass cls, SadlValueList listInitializer) {
com.hp.hpl.jena.rdf.model.Resource to = null;
ExtendedIterator<OntClass> scitr = cls.listSuperClasses(true);
while (scitr.hasNext()) {
OntClass sc = scitr.next();
if (sc.isRestriction()
&& ((sc.as(Restriction.class)).isAllValuesFromRestriction() && sc.as(AllValuesFromRestriction.class)
.onProperty(getTheJenaModel().getProperty(SadlConstants.SADL_LIST_MODEL_FIRST_URI)))) {
to = sc.as(AllValuesFromRestriction.class).getAllValuesFrom();
break;
}
}
if (to == null) {
// addError("No 'to' resource found in restriction of List subclass",
// listInitializer);
}
Iterator<SadlExplicitValue> values = listInitializer.getExplicitValues().iterator();
addValueToList(null, inst, cls, to, values);
}