@Override public OntResource map1( RDFNode o ) { return ((Resource) o).as( OntResource.class ); }} ); }
@Override public T map1( Resource x ) { return x.as( m_as ); } }
/** * <p>Answer a resource presenting the {@link OntResource} facet, which has the * given URI.</p> * @param uri The URI of the resource, or null for an anonymous resource (aka bNode) * @return An OntResource with the given URI */ @Override public OntResource createOntResource( String uri ) { return getResource( uri ).as( OntResource.class ); }
/** * <p>Add a sub-class of this class.</p> * @param cls A class that is a sub-class of this class. * @exception OntProfileException If the {@link Profile#SUB_CLASS_OF()} property is not supported in the current language profile. */ @Override public void addSubClass( Resource cls ) { cls.as( OntClass.class ).addSuperClass( this ); }
/** * <p>Answer a resource presenting the {@link OntResource} facet, which * corresponds to the given resource but attached to this model.</p> * @param res An existing resource * @return An {@link OntResource} attached to this model that has the same URI * or anonID as the given resource */ @Override public OntResource getOntResource( Resource res ) { return res.inModel( this ).as( OntResource.class ); }
/** * <p>Remove the given class from the sub-classes of this class. If this statement * is not true of the current model, nothing happens.</p> * @param cls A class to be removed from the sub-classes of this class * @exception OntProfileException If the {@link Profile#SUB_CLASS_OF()} class is not supported in the current language profile. */ @Override public void removeSubClass( Resource cls ) { (cls.as( OntClass.class)).removeSuperClass( this ); }
@Override public T map1( Statement x ) { return x.getSubject().as( m_as ); } }
private static List<RDFNode> asJavaList( Resource resource ) { return (resource.as( RDFList.class )).asJavaList(); }
@Override public Alt getAlt( Resource r ) { return r.inModel( this ).as( Alt.class ); }
private static Property configTextQueryProperty( Resource endpoint, Property ifUnspecified ) { Resource tqp = endpoint.getPropertyResourceValue( ELDA_API.textQueryProperty ); return tqp == null ? ifUnspecified : tqp.as(Property.class); }
private static Property configTextContentProperty( Resource endpoint, Property ifUnspecified ) { Resource tcp = endpoint.getPropertyResourceValue( ELDA_API.textContentProperty ); return tcp == null ? ifUnspecified : tcp.as(Property.class); }
/** Answer a (the) new empty list @return An RDF-encoded list of no elements (ie nil) */ @Override public RDFList createList() { return getResource( RDF.nil.getURI() ).as( RDFList.class ); }
/** * <p>Answer a resource presenting the {@link OntResource} facet, which has the given * URI. If no such resource is currently present in the model, return null.</p> * @param uri The URI of a resource * @return An OntResource with the given URI, or null */ @Override public OntResource getOntResource( String uri ) { Resource r = getResource( uri ); if (containsResource( r )) { return r.as( OntResource.class ); } return null; }
private static AnyList convertList(Resource tso) { if (tso.canAs(RDFList.class)) { List<RDFNode> operand = tso.as(RDFList.class).asJavaList(); Any[] elements = new Any[operand.size()]; for (int i = 0; i < operand.size(); i += 1) elements[i] = RDFQ.any( operand.get(i) ); return RDFQ.list( elements ); } else { EldaException.BadSpecification( "Object " + tso + " of " + ELDA_API.textSearchOperand + " must be an RDF list." ); return /* never */ null; } }
/** * <p>Answer a new empty list. This method overrides the list create method in ModelCom, * to allow both DAML and RDFS lists to be created.</p> * @return An RDF-encoded list of no elements, using the current language profile */ @Override public RDFList createList() { Resource list = getResource( getProfile().NIL().getURI() ); return list.as( RDFList.class ); }
/** * Obtains the label for the {@link Restriction} of type {@link com.hp.hpl.jena.ontology.SomeValuesFromRestriction}. * * @param restriction the restriction being examined * @return the someValuesFrom restriction value as a string */ private String getSomeValuesFromRestriction(@Nonnull final Restriction restriction) { final OntClass ontClass = restriction.asSomeValuesFromRestriction().getSomeValuesFrom().as(OntClass.class); return !hasHierarchyRootAsParent(ontClass, !DIRECT) ? ontClass.getLabel(null) : getFormattedOntClassId(ontClass.getLocalName()); }
/** * Obtains the label for the {@link Restriction} of type {@link com.hp.hpl.jena.ontology.SomeValuesFromRestriction}. * * @param restriction the restriction being examined * @return the someValuesFrom restriction value as a string */ private String getSomeValuesFromRestriction(@Nonnull final Restriction restriction) { final OntClass ontClass = restriction.asSomeValuesFromRestriction().getSomeValuesFrom().as(OntClass.class); return !hasHierarchyRootAsParent(ontClass, !DIRECT) ? ontClass.getLabel(null) : getFormattedOntClassId(ontClass.getLocalName()); }
private void createObjects(OntModel ontModel, Model model) { ExtendedIterator extendedIterator = ontModel.listIndividuals(); while (extendedIterator.hasNext()) { Individual individual = (Individual) extendedIterator.next(); OntClass ontClass = (OntClass) individual.getRDFType().as(OntClass.class); createAndAdd(model, individual.getURI(), ontClass.getLocalName()); } }
/** * <p>Answer a property that is the sub-property of this property. If there is * more than one such property, an arbitrary selection is made.</p> * @return A sub-property of this property * @exception OntProfileException If the {@link Profile#SUB_PROPERTY_OF()} property is not supported in the current language profile. */ @Override public OntProperty getSubProperty() { checkProfile( getProfile().SUB_PROPERTY_OF(), "SUB_PROPERTY_OF" ); return getModel().listStatements( null, getProfile().SUB_PROPERTY_OF(), this ) .nextStatement() .getSubject() .as( OntProperty.class ); }
protected static void addDomainTypes( Model result, Model schema ) { for (StmtIterator it = schema.listStatements( ANY, RDFS.domain, ANY ); it.hasNext();) { Statement s = it.nextStatement(); Property property = s.getSubject().as( Property.class ); RDFNode type = s.getObject(); for (StmtIterator x = result.listStatements( ANY, property, ANY ); x.hasNext();) { Statement t = x.nextStatement(); result.add( t.getSubject(), RDF.type, type ); } } }