Skip to content
Fetching contributors…
Cannot retrieve contributors at this time
130 lines (105 sloc) 12.2 KB
require File.join(File.dirname(__FILE__), 'spec_helper')
describe RDF::Vocabulary do
VOCABS = %w(cc cert dc doap exif foaf geo http owl rdfs rsa rss sioc skos wot xhtml xsd)
context "when created" do
it "should require one argument" do
lambda { }.should raise_error(ArgumentError)
lambda {"") }.should_not raise_error
lambda {"", "") }.should raise_error(ArgumentError)
context "pre-defined vocabularies" do
it "should support pre-defined vocabularies" do { |s| s.to_s.upcase.to_sym }.each do |vocab|
lambda { RDF.const_get(vocab) }.should_not raise_error(NameError)
it "should support Creative Commons (CC)" do
RDF::CC.should be_a_vocabulary("")
RDF::CC.should have_properties("", %w(attributionName attributionURL deprecatedOn jurisdiction legalcode license morePermissions permits prohibits requires))
it "should support W3 Authentication Certificate (CERT)" do
RDF::CERT.should be_a_vocabulary("")
RDF::CERT.should have_properties("", %w(decimal hex identity public_key))
RDF::CERT.should have_subclasses("", %w(Certificate Integer Key PGPCertificate PrivateKey PublicKey Signature X509Certificate))
it "should support Dublin Core (DC)" do
RDF::DC.should be_a_vocabulary("")
RDF::DC.should have_properties("", %w(abstract accessRights accrualMethod accrualPeriodicity accrualPolicy alternative audience available bibliographicCitation conformsTo contributor coverage created creator date dateAccepted dateCopyrighted dateSubmitted description educationLevel extent format hasFormat hasPart hasVersion identifier instructionalMethod isFormatOf isPartOf isReferencedBy isReplacedBy isRequiredBy isVersionOf issued language license mediator medium modified provenance publisher references relation replaces requires rights rightsHolder source spatial subject tableOfContents temporal title type valid))
it "should support Description of a Project (DOAP)" do
RDF::DOAP.should be_a_vocabulary("")
RDF::DOAP.should have_properties("", %w(anon-root audience blog browse bug-database category created description developer documenter download-mirror download-page file-release helper homepage implements language license location mailing-list maintainer module name old-homepage os platform programming-language release repository revision screenshots service-endpoint shortdesc tester translator vendor wiki))
it "should support Exchangeable Image File Format (EXIF)" do
RDF::EXIF.should be_a_vocabulary("")
RDF::EXIF.should have_properties("", %w(_unknown apertureValue artist bitsPerSample brightnessValue cfaPattern colorSpace componentsConfiguration compressedBitsPerPixel compression contrast copyright customRendered datatype date dateAndOrTime dateTime dateTimeDigitized dateTimeOriginal deviceSettingDescription digitalZoomRatio exifAttribute exifVersion exif_IFD_Pointer exifdata exposureBiasValue exposureIndex exposureMode exposureProgram exposureTime fNumber fileSource flash flashEnergy flashpixVersion focalLength focalLengthIn35mmFilm focalPlaneResolutionUnit focalPlaneXResolution focalPlaneYResolution gainControl geo gpsAltitude gpsAltitudeRef gpsAreaInformation gpsDOP gpsDateStamp gpsDestBearing gpsDestBearingRef gpsDestDistance gpsDestDistanceRef gpsDestLatitude gpsDestLatitudeRef gpsDestLongitude gpsDestLongitudeRef gpsDifferential gpsImgDirection gpsImgDirectionRef gpsInfo gpsInfo_IFD_Pointer gpsLatitude gpsLatitudeRef gpsLongitude gpsLongitudeRef gpsMapDatum gpsMeasureMode gpsProcessingMethod gpsSatellites gpsSpeed gpsSpeedRef gpsStatus gpsTimeStamp gpsTrack gpsTrackRef gpsVersionID height ifdPointer imageConfig imageDataCharacter imageDataStruct imageDescription imageLength imageUniqueID imageWidth interopInfo interoperabilityIndex interoperabilityVersion interoperability_IFD_Pointer isoSpeedRatings jpegInterchangeFormat jpegInterchangeFormatLength length lightSource make makerNote maxApertureValue meter meteringMode mm model oecf orientation photometricInterpretation pictTaking pimBrightness pimColorBalance pimContrast pimInfo pimSaturation pimSharpness pixelXDimension pixelYDimension planarConfiguration primaryChromaticities printImageMatching_IFD_Pointer recOffset referenceBlackWhite relatedFile relatedImageFileFormat relatedImageLength relatedImageWidth relatedSoundFile resolution resolutionUnit rowsPerStrip samplesPerPixel saturation sceneCaptureType sceneType seconds sensingMethod sharpness shutterSpeedValue software spatialFrequencyResponse spectralSensitivity stripByteCounts stripOffsets subSecTime subSecTimeDigitized subSecTimeOriginal subjectArea subjectDistance subjectDistanceRange subjectLocation subseconds tag_number tagid transferFunction userComment userInfo versionInfo whiteBalance whitePoint width xResolution yCbCrCoefficients yCbCrPositioning yCbCrSubSampling yResolution))
it "should support Friend of a Friend (FOAF)" do
RDF::FOAF.should be_a_vocabulary("")
RDF::FOAF.should have_properties("", %w(account accountName accountServiceHomepage age aimChatID based_near birthday currentProject depiction depicts dnaChecksum familyName family_name firstName fundedBy geekcode gender givenName givenname holdsAccount homepage icqChatID img interest isPrimaryTopicOf jabberID knows lastName logo made maker mbox mbox_sha1sum member membershipClass msnChatID myersBriggs name nick openid page pastProject phone plan primaryTopic publications schoolHomepage sha1 skypeID status surname theme thumbnail tipjar title topic topic_interest weblog workInfoHomepage workplaceHomepage yahooChatID))
it "should support WGS84 Geo Positioning (GEO)" do
RDF::GEO.should be_a_vocabulary("")
RDF::GEO.should have_properties("", %w(lat location long alt lat_long))
RDF::GEO.should have_subclasses("", %w(SpatialThing Point))
it "should support Hypertext Transfer Protocol (HTTP)" do
RDF::HTTP.should be_a_vocabulary("")
RDF::HTTP.should have_properties("", %w(abs_path absoluteURI authority body connectionAuthority elementName elementValue fieldName fieldValue header param paramName paramValue request requestURI response responseCode version))
it "should support Web Ontology Language (OWL)" do
RDF::OWL.should be_a_vocabulary("")
RDF::OWL.should have_properties("", %w(allValuesFrom annotatedProperty annotatedSource annotatedTarget assertionProperty backwardCompatibleWith bottomDataProperty bottomObjectProperty cardinality complementOf datatypeComplementOf deprecated differentFrom disjointUnionOf disjointWith distinctMembers equivalentClass equivalentProperty hasKey hasSelf hasValue imports incompatibleWith intersectionOf inverseOf maxCardinality maxQualifiedCardinality members minCardinality minQualifiedCardinality onClass onDataRange onDatatype onProperties onProperty oneOf priorVersion propertyChainAxiom propertyDisjointWith qualifiedCardinality sameAs someValuesFrom sourceIndividual targetIndividual targetValue topDataProperty topObjectProperty unionOf versionIRI versionInfo withRestrictions))
it "should support Resource Description Framework (RDF)" do
RDF.should be_a_vocabulary("")
RDF.should have_properties("", %w(first object predicate rest subject type value))
it "should support RDF Schema (RDFS)" do
RDF::RDFS.should be_a_vocabulary("")
RDF::RDFS.should have_properties("", %w(comment domain isDefinedBy label member range seeAlso subClassOf subPropertyOf))
RDF::RDFS.should have_subclasses("", %w(Class Container ContainerMembershipProperty Datatype Literal Resource))
it "should support W3 RSA Keys (RSA)" do
RDF::RSA.should be_a_vocabulary("")
RDF::RSA.should have_properties("", %w(modulus private_exponent public_exponent))
RDF::RSA.should have_subclasses("", %w(RSAKey RSAPrivateKey RSAPublicKey))
it "should support RDF Site Summary (RSS)" do
RDF::RSS.should be_a_vocabulary("")
RDF::RSS.should have_properties("", %w(description items link name title url))
it "should support Semantically-Interlinked Online Communities (SIOC)" do
RDF::SIOC.should be_a_vocabulary("")
RDF::SIOC.should have_properties("", %w(about account_of administrator_of attachment avatar container_of content content_encoded created_at creator_of description earlier_version email email_sha1 feed first_name follows function_of group_of has_administrator has_container has_creator has_discussion has_function has_group has_host has_member has_moderator has_modifier has_owner has_parent has_part has_reply has_scope has_space has_subscriber has_usergroup host_of id ip_address last_activity_date last_item_date last_name last_reply_date later_version latest_version link links_to member_of moderator_of modified_at modifier_of name next_by_date next_version note num_authors num_items num_replies num_threads num_views owner_of parent_of part_of previous_by_date previous_version reference related_to reply_of scope_of sibling space_of subject subscriber_of title topic usergroup_of))
it "should support Simple Knowledge Organization System (SKOS)" do
RDF::SKOS.should be_a_vocabulary("")
RDF::SKOS.should have_properties("", %w(altLabel broadMatch broader broaderTransitive changeNote closeMatch definition editorialNote exactMatch example hasTopConcept hiddenLabel historyNote inScheme mappingRelation member memberList narrowMatch narrower narrowerTransitive notation note prefLabel related relatedMatch scopeNote semanticRelation topConceptOf))
it "should support Web of Trust (WOT)" do
RDF::WOT.should be_a_vocabulary("")
RDF::WOT.should have_properties("", %w(assurance encryptedTo encrypter fingerprint hasKey hex_id identity length pubkeyAddress sigdate signed signer sigtime))
it "should support Extensible HyperText Markup Language (XHTML)" do
RDF::XHTML.should be_a_vocabulary("")
RDF::XHTML.should have_properties("", %w()) # TODO
it "should support XML Schema (XSD)" do
RDF::XSD.should be_a_vocabulary("")
RDF::XSD.should have_properties("", %w(NOTATION QName anyURI base64Binary boolean date dateTime decimal double duration float gDay gMonth gMonthDay gYear gYearMonth hexBinary string time ENTITIES ENTITY ID IDREF IDREFS NCName NMTOKEN NMTOKENS Name byte int integer language long negativeInteger nonNegativeInteger nonPositiveInteger normalizedString positiveInteger short token unsignedByte unsignedInt unsignedLong unsignedShort))
context "ad-hoc vocabularies" do
it "should support ad-hoc vocabularies" do
dc ="")
dc.creator.should be_kind_of(RDF::URI)
dc[:creator].should be_kind_of(RDF::URI)
dc.creator.should eql(RDF::DC.creator)
dc.title.should be_kind_of(RDF::URI)
dc[:title].should be_kind_of(RDF::URI)
dc.title.should eql(RDF::DC.title)
Jump to Line
Something went wrong with that request. Please try again.