本文整理了Java中com.hp.hpl.jena.rdf.model.Model.listObjectsOfProperty()
方法的一些代码示例,展示了Model.listObjectsOfProperty()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Model.listObjectsOfProperty()
方法的具体详情如下:
包路径:com.hp.hpl.jena.rdf.model.Model
类名称:Model
方法名:listObjectsOfProperty
[英]List all objects of a given property. .remove() is not implemented on this iterator.
[中]列出给定属性的所有对象。此迭代器上未实现remove()。
代码示例来源:origin: fr.inria.eventcloud/eventcloud-api
/**
* {@inheritDoc}
*/
@Override
public NodeIterator listObjectsOfProperty(Property p) {
return super.object.listObjectsOfProperty(p);
}
代码示例来源:origin: fr.inria.eventcloud/eventcloud-api
/**
* {@inheritDoc}
*/
@Override
public NodeIterator listObjectsOfProperty(Resource s, Property p) {
return super.object.listObjectsOfProperty(s, p);
}
代码示例来源:origin: bio2rdf/bio2rdf-scripts
public NodeIterator listObjectsOfProperty(Property p) {
return model.listObjectsOfProperty(p);
}
代码示例来源:origin: bio2rdf/bio2rdf-scripts
public NodeIterator listObjectsOfProperty(Resource s, Property p) {
return model.listObjectsOfProperty(s, p);
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private JSONArray getWorksheetHistory(Resource mappingResource) throws JSONException {
Property hasTransformation = model.getProperty(Uris.KM_HAS_WORKSHEET_HISTORY_URI);
NodeIterator transItr = model.listObjectsOfProperty(mappingResource, hasTransformation);
while (transItr.hasNext()) {
String commands = transItr.next().toString();
return new JSONArray(commands);
}
return new JSONArray();
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private List<String> getVariables(Model model, Resource service_resource) {
Property has_variable_property = model.getProperty(Namespaces.KARMA + "hasVariable");
List<String> variables = new ArrayList<>();
NodeIterator nodeIterator;
RDFNode node;
// hasAttribute
nodeIterator = model.listObjectsOfProperty(service_resource, has_variable_property);
while ( nodeIterator.hasNext()) {
node = nodeIterator.next();
if (!node.isResource()) {
logger.info("object of the hasAttribute property is not a resource.");
continue;
}
variables.add(node.asResource().getLocalName());
}
return variables;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private List<Attribute> getAttributes(Model model, Resource source_resource) {
Property has_attribute_property = model.getProperty(Namespaces.KARMA + "hasAttribute");
List<Attribute> attList = new ArrayList<>();
NodeIterator nodeIterator = null;
RDFNode node = null;
// hasAttribute
nodeIterator = model.listObjectsOfProperty(source_resource, has_attribute_property);
while ( nodeIterator.hasNext()) {
node = nodeIterator.next();
if (!node.isResource()) {
logger.info("object of the hasAttribute property is not a resource.");
continue;
}
attList.add(getSingleAttribute(model, node.asResource()));
}
return attList;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private List<String> getVariables(Model model, Resource source_resource) {
Property has_variable_property = model.getProperty(Namespaces.KARMA + "hasVariable");
List<String> variables = new ArrayList<>();
NodeIterator nodeIterator = null;
RDFNode node = null;
// hasAttribute
nodeIterator = model.listObjectsOfProperty(source_resource, has_variable_property);
while ( nodeIterator.hasNext()) {
node = nodeIterator.next();
if (!node.isResource()) {
logger.info("object of the hasAttribute property is not a resource.");
continue;
}
variables.add(node.asResource().getLocalName());
}
return variables;
}
代码示例来源:origin: epimorphics/elda
private void extractEndpointSpecifications( Resource specification ) {
NodeIterator ni = specification.getModel().listObjectsOfProperty(specification, API.endpoint);
while (ni.hasNext() ) {
RDFNode n = ni.next();
if ( ! (n instanceof Resource)) {
throw new APIException("Bad specification file, non-resource definition of Endpoint. " + n);
}
Resource endpoint = (Resource) n;
// endpoints.add( new APIEndpointSpec( this, this, endpoint ) );
endpoints.add( getAPIEndpointSpec( endpoint) );
}
}
代码示例来源:origin: org.dataconservancy.dcs/dcs-package-validation
private void visitAggregatedResources(Resource agg, File base_dir, Model model, List<String> visitedRems) throws PackageValidationException {
NodeIterator iter = model.listObjectsOfProperty(agg, AGGREGATES_PROPERTY);
while (iter.hasNext()) {
Resource res = iter.next().asResource();
if (res.hasProperty(IS_DESCRIBED_BY_PROPERTY)) {
validateResourceMap(res.getPropertyResourceValue(IS_DESCRIBED_BY_PROPERTY), base_dir,
model, visitedRems.toArray(new String[0]));
}
}
}
代码示例来源:origin: epimorphics/elda
public void addViewers(Resource root, Map<String, View> views) {
Model m = root.getModel();
for (NodeIterator ni = m.listObjectsOfProperty( root, API.viewer ); ni.hasNext();) {
RDFNode tNode = ni.next();
if (!tNode.isResource())
throw new APIException("Found literal " + tNode + " when expecting a view resource");
View v = getView( (Resource) tNode );
views.put( v.name(), v );
explicitViewNames.add( v.name() );
}
}
代码示例来源:origin: epimorphics/elda
/**
Add properties to the view, setting the property chains and possibly
the labelled-describe label property URI.
*/
private View addViewProperties( Model m, Set<Resource> seen, Resource tRes, View v ) {
setDescribeLabelIfPresent( tRes, v );
addViewPropertiesByString( v, m.listObjectsOfProperty( tRes, API.properties ).toList() );
addViewPropertiesByResource( v, m.listObjectsOfProperty( tRes, API.property ).toList() );
for (RDFNode n: tRes.listProperties( API.include ).mapWith( Statement.Util.getObject ).toList()) {
if (n.isResource() && seen.add( (Resource) n ))
addViewProperties( m, seen, (Resource) n, v );
}
return v;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private Atom getAtom(Model model, Resource atom_resource) {
Property rdf_type = model.getProperty(Namespaces.RDF + "type");
NodeIterator nodeIterator = null;
RDFNode node = null;
String classAtomUri = Namespaces.SWRL + "ClassAtom";
String propertyAtomUri = Namespaces.SWRL + "IndividualPropertyAtom";
// atom type
nodeIterator = model.listObjectsOfProperty(atom_resource, rdf_type);
if (!nodeIterator.hasNext() || !(node = nodeIterator.next()).isResource()) {
logger.info("The atom type is not specified.");
return null;
}
if (node.asResource().getURI().equalsIgnoreCase(classAtomUri)) {
logger.debug("The atom is a ClassAtom");
return getClassAtom(model, atom_resource);
}
else if (node.asResource().getURI().equalsIgnoreCase(propertyAtomUri)) {
logger.debug("The atom is an IndividualPropertyAtom");
return getPropertyAtom(model, atom_resource);
}
return null;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private Atom getAtom(Model model, Resource atom_resource) {
Property rdf_type = model.getProperty(Namespaces.RDF + "type");
NodeIterator nodeIterator;
RDFNode node;
String classAtomUri = Namespaces.SWRL + "ClassAtom";
String propertyAtomUri = Namespaces.SWRL + "IndividualPropertyAtom";
// atom type
nodeIterator = model.listObjectsOfProperty(atom_resource, rdf_type);
if (!nodeIterator.hasNext() || !(node = nodeIterator.next()).isResource()) {
logger.info("The atom type is not specified.");
return null;
}
if (node.asResource().getURI().equalsIgnoreCase(classAtomUri)) {
logger.debug("The atom is a ClassAtom");
return getClassAtom(model, atom_resource);
}
else if (node.asResource().getURI().equalsIgnoreCase(propertyAtomUri)) {
logger.debug("The atom is an IndividualPropertyAtom");
return getPropertyAtom(model, atom_resource);
}
return null;
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private void createPredicateObjectMaps(Resource mappingResource, KR2RMLMapping kr2rmlMapping) throws JSONException {
Property hasTrMapUri = model.getProperty(Uris.KM_HAS_TRIPLES_MAP_URI);
// Get all the triple maps
NodeIterator trMapsResItr = model.listObjectsOfProperty(mappingResource, hasTrMapUri);
while (trMapsResItr.hasNext()) {
// Add the predicate object maps
addPredicateObjectMapsForTripleMap(trMapsResItr.next().asResource(), kr2rmlMapping);
}
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private Attribute getSingleAttribute(Model model, Resource att_resource) {
String att_id = "";
String att_name = "";
Property has_name_property = model.getProperty(Namespaces.KARMA + "hasName");
// attribute id
att_id = att_resource.getLocalName();
logger.debug("attribute id: " + att_id);
NodeIterator nodeIterator = null;
RDFNode node = null;
// attribute name
nodeIterator = model.listObjectsOfProperty(att_resource, has_name_property);
if (nodeIterator.hasNext() && (node = nodeIterator.next()).isLiteral()) {
att_name = node.asLiteral().getString();
logger.debug("attribute name: " + att_name);
} else
logger.debug("attribute does not have a name.");
Attribute att = new Attribute(att_id, att_resource.getNameSpace(), att_name, IOType.NONE, AttributeRequirement.NONE);
return att;
}
代码示例来源:origin: org.apache.clerezza.ext/org.apache.jena.jena-core
/**
* Name space stuff.
*/
private void addTypeNameSpaces() {
NodeIterator nn = model.listObjectsOfProperty(RDF.type);
try {
while (nn.hasNext()) {
RDFNode obj = nn.nextNode();
int split = isOKType(obj);
if (split != -1)
prettyWriter.addNameSpace(((Resource) obj).getURI()
.substring(0, split));
}
} finally {
nn.close();
}
}
代码示例来源:origin: org.dataconservancy.packaging/dcs-pkg-ingest-services
private void visitAggregatedResources(Resource agg, State state)
throws StatefulIngestServiceException {
NodeIterator iter = state.model.listObjectsOfProperty(agg, AGGREGATES_PROPERTY);
while (iter.hasNext()) {
Resource res = iter.next().asResource();
if (res.hasProperty(IS_DESCRIBED_BY_PROPERTY)) {
// Careful about this, this is where we could have a loop...
visitResourceMap(res.getPropertyResourceValue(IS_DESCRIBED_BY_PROPERTY), state);
} else {
visitByteStream(res, state);
}
}
}
代码示例来源:origin: usc-isi-i2/Web-Karma
private List<Resource> createSubjectMaps(Resource mappingResource, KR2RMLMapping kr2rmlMapping) throws JSONException {
List<Resource> subjectMapResources = new ArrayList<>();
Property hasTrMapUri = model.getProperty(Uris.KM_HAS_TRIPLES_MAP_URI);
// Get all the triple maps
NodeIterator trMapsResItr = model.listObjectsOfProperty(mappingResource, hasTrMapUri);
while (trMapsResItr.hasNext()) {
Resource trMapRes = trMapsResItr.next().asResource();
SubjectMap subjMap = addSubjectMapForTripleMap(trMapRes, kr2rmlMapping, subjectMapResources);
// Add the Triples map
TriplesMap trMap = new TriplesMap(trMapRes.getURI(), subjMap);
kr2rmlMapping.getTriplesMapIndex().put(trMapRes.getURI(), trMap);
kr2rmlMapping.addTriplesMap(trMap);
kr2rmlMapping.getAuxInfo().getTriplesMapGraph().addTriplesMap(trMap);
}
return subjectMapResources;
}
代码示例来源:origin: epimorphics/elda
private void extractDatatypes( Model m ) {
List<Resource> dataTypes = m.listStatements( null, RDF.type, RDFS.Datatype ).mapWith( Statement.Util.getSubject ).toList();
for (Resource t: dataTypes) declareDatatype( t.getURI() );
for (Resource p: m.listSubjectsWithProperty( RDF.type, OWL.DatatypeProperty ).toList()) {
for (RDFNode t: m.listObjectsOfProperty( p, RDFS.range ).toList()) {
declareDatatype( t.asResource().getURI() );
}
}
}
内容来源于网络,如有侵权,请联系作者删除!